Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HeapCreate, HeapAlloc in Linux, private allocator for Linux

In Windows, for very demanding applications, a programmer may use HeapCreate, HeapAlloc in order to better manage and control the allocation of memory- speed it up (aka private allocators). What is the equivalent in Linux c++ programming?

like image 957
Petre Avatar asked May 21 '10 08:05

Petre


1 Answers

If you want to use your own private allocator, then use mmap() to map an amount of memory into your process, then you can use that memory as you like. Open a file descriptor to /dev/zero, and then use that as the 'fildes' parameter to mmap(). See man mmap for full details of the parameters to pass. In this respect mmap() plays the same role as HeapCreate().

like image 56
psmears Avatar answered Sep 20 '22 17:09

psmears