views:

78

answers:

3

Hey,

What's the equivalent to Windows's VirtualAlloc in OS X? That is, how can i reserve a contiguous address space without actually commiting it and then commit chunks of it later?

Thanks,

Alex

A: 

No, unfortunately, there is no exact equivalent to VirtualAlloc.

Pablo Santa Cruz
A: 

What language are you coding in?

alexy13
The question is tagged `c`.
dreamlax
+4  A: 

The mmap() function, called with MAP_ANON | MAP_PRIVATE, is very roughly equivalent to VirtualAlloc() with the MEM_RESERVE flag. Memory is then committed by touching each page in the mapping.

caf