Passing non NULL to base address parameter of NtAllocateVirtualMemory

Discussion in 'Visual C++ .Net' started by DN Admin, Apr 24, 2012.

  1. DN Admin

    Staff Member

    United States
    Aug 7, 2010
    Likes Received:
    Trophy Points:
    Joliet, IL U.S.A.
    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

Share This Page