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

    Country:
    United States
    Joined:
    Aug 7, 2010
    Location:
    Joliet, IL U.S.A.
    Hello,
    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

    Thanks


    View the full article
     
    #1

Share This Page