I am investigating the behavior of the C runtime regarding memory allocation (malloc, calloc, realloc, etc excluding VirtualAlloc).
It seems that all libc allocation will eventually reach NtAllocateVirtualMemory (user mode).
I observe the following scenarios when the runtime calls NtAllocateVirtualMemory:
1. Runtime always pass NULL to base address parameter when trying to reserve memory or commit big chunk of memory
2. Runtime always pass non-NULL to base address parameter when trying to commit a reserved memory.
I was wondering if the CRT always behaves like this or there are other kinds of variations.
My dev environment:
- windows 7 professional
- visual studio 10
View the full article