The MASM Forum

General => The Campus => Topic started by: Magnum on May 10, 2013, 07:09:29 AM

Title: VirtualAlloc
Post by: Magnum on May 10, 2013, 07:09:29 AM
When a breakpoint is set after this, Windows Task Manager doesn't show any change in available physical memory.

Shouldn't it ?


invoke VirtualAlloc, NULL, 1024000, MEM_COMMIT, PAGE_READWRITE

Title: Re: VirtualAlloc
Post by: qWord on May 10, 2013, 07:34:19 AM
Quote from: msdn
MEM_COMMIT

Allocates memory charges (from the overall size of memory and the paging files on disk) for the specified reserved memory pages. The function also guarantees that when the caller later initially accesses the memory, the contents will be zero. Actual physical pages are not allocated unless/until the virtual addresses are actually accessed. [...]
Title: Re: VirtualAlloc
Post by: Magnum on May 10, 2013, 07:51:07 AM
Thanks.

Both the Programmers Reference(OLD) and the 2003 Platform SDK don't have that info.

Andy
Title: Re: VirtualAlloc
Post by: Adamanteus on May 10, 2013, 09:24:34 AM
  That's looks that page allocated when to Windows it's need - but, if it's need from start of program - it's already allocated from global heap seen by Task manager. I ever count this function allocates memory in special pool - and need to use when, small allocations (program critical) need be guaranteed (from this pool), so possible not check NULL-returned values, hoping on Windows memory manager.