When the lpAddress
parameter to a VirtualAlloc
function call is null, how does the OS determine which virtual address space region to allocate?
Asked
Active
Viewed 458 times
2

Cairnarvon
- 25,981
- 9
- 51
- 65

user101847
- 81
- 1
- 5
-
Would I be correct in interpreting this question as 'How does malloc work?'? – Patashu May 26 '13 at 04:06
-
2Can you tell us more about the reason *why* you're asking this question? Why do you think you need to know this information? Why is it relevant to the design of your application, or your call to the function? If you care about the region, you should pass something for `lpAddress`. If you pass `NULL`, then you don't care by definition. – Cody Gray - on strike May 26 '13 at 06:26
-
@Patashu No, you'd be confusing the OS's low-level virtual memory system with a fine-grained general-purpose allocator in the C standard library. – May 26 '13 at 08:49
-
Short version: the OS allocates the new block in any suitable currently unused region of the virtual address space. – Harry Johnston May 27 '13 at 04:42