God's in his heaven.
All's right with the world.

0%

(Stack Overflow) HeapCreate, HeapAlloc in Linux, private allocator for Linux

Question

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?

Answer by psmears

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().


Article link: http://xnerv.wang/heapcreate-heapalloc-in-linux-private-allocator-for-linux/
Reprinted from: (StackOverflow) HeapCreate, HeapAlloc in Linux, private allocator for Linux