On Jun 28, 2005, at 10:06 PM, Mohanasundaram Chandran wrote: I am in the process of implementing a memory manager for Darwin.I Linux i used the sys_brk system call (not the user lever legacy POSIX brk function.). I would like to know what is the similar system call in Darwin. Can anybody help please?
Darwin does not use the simplistic heap model that is traditional in many *nix systems, due to the very complex memory map you find in typical MacOS X applications.
User programs (and that includes library code) that wants to allocate process virtual space can use malloc, if the chunk will be managed whole. This is the simplest (and most portable) way to go about it.
If you don't have a 1:1 allocate:free model, then vm_allocate and vm_deallocate are the interfaces that you're looking for.
See the source code for the default Darwin allocator in Libc/gen/scalable_malloc.c
= Mike
|