It is currently Wed, 23 Jul 2014 09:01:18 GMT



 
Author Message
 Question: mmap() vs. sbrk() in malloc?

I recently wrote my own malloc implementation.  While doing research for
this project, I came across a number of implementations that use mmap()
instead of sbrk().  I was wondering, what are the advantages of mmap()?
--
"With a touch more confidence and a liberal helping of ignorance I would have
been a famous evangelist."
                        -- Stranger In A Strange Land
PLENTY of ignorance at http://www.**-**.com/ ~idr



 Fri, 28 Apr 2000 03:00:00 GMT   
 Question: mmap() vs. sbrk() in malloc?

 Ian> I recently wrote my own malloc implementation.  While doing
 Ian> research for this project, I came across a number of
 Ian> implementations that use mmap() instead of sbrk().  I was
 Ian> wondering, what are the advantages of mmap()?

The main advantage of mmap() is the ability to use munmap() to release
the memory when no longer required.

Another trick I've seen used (in phkmalloc) is using mmap to maintain
a separate page directory outside the main malloc arena, rather than
keeping all the housekeeping info mixed in with the data (which does
{*filter*} things to the alignment).

--
Andrew.

comp.unix.programmer FAQ: see <URL: http://www.**-**.com/ ;
                           or <URL: http://www.**-**.com/ ;



 Fri, 28 Apr 2000 03:00:00 GMT   
 
   [ 2 post ] 

Similar Threads

1. mmap() vs sbrk() -- Question ??

2. mmap -vs- sbrk

3. sbrk/malloc question

4. malloc(), sbrk() conflicts?

5. sbrk, malloc and gcc (2.6.0) in SunOS 4.1.3

6. When will malloc use sbrk?

7. Mixing malloc() and sbrk() safe on Linux?

8. sbrk and mmap

9. usage and example of mmap,msync,sbrk....


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software