This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Heap allocation on Linux
- From: Jean-Eric <jec at rptec dot ch>
- To: libstdc++ at gcc dot gnu dot org
- Date: Mon, 06 Dec 2004 20:09:16 +0100
- 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