This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
RE: Heap allocation on Linux
- From: "Emery Berger" <emery at cs dot umass dot edu>
- To: "Jean-Eric" <jec at rptec dot ch>,<libstdc++ at gcc dot gnu dot org>
- Date: Wed, 8 Dec 2004 10:18:49 -0500
- Subject: RE: Heap allocation on Linux
Hi,
Hoard (www.hoard.org) is a GPLed memory allocator that uses mmap, not
sbrk. It's also a lot faster than the Linux allocator (even on
single-threaded codes) and more scalable.
-- emery
> -----Original Message-----
> From: Jean-Eric [mailto:jec@rptec.ch]
> Sent: Monday, December 06, 2004 2:09 PM
> To: libstdc++@gcc.gnu.org
> Subject: Heap allocation on Linux
>
> Hi,
> We have a big soft written in C++, so we have a lot of new/delete
> On Windows, we use the Heap function from, Win32 API, and that s
working
> fine.
> Does someone knows of something similar on Linux?
> The problem is:
> - Allocating block A (brk() is called to extend virtual address space)
> - Allocating block B (brk() is called to extend virtual address space)
> - Allocating block C (brk() is called to extend virtual address space)
> - Allocating block D (brk() is called to extend virtual address space)
> - Mem used is X
> - Releasing block A
> - Releasing block B
> - Releasing block C
> - Shrink addr space (No shrink since block D is still needed)
> - Mem used is still X
>
> That s a problem for our soft. What would be good is a mmap() based
> allocator:
> - Allocate an mmap chunk
> - Allocate from it
> - munmap it when all blocks are freed
>
> Thanks for infos.
> -jec
>