-Ross
"Bill T" <bil...@charter.net> wrote in message
news:O4HCJth...@TK2MSFTNGP02.phx.gbl...
http://channel9.msdn.com/wiki/default.aspx/CeDeveloper.BSPVMOptimization
--
Wes B [MSFT]
I have looked at this a bit and written sample code that steps through the
memory in each process slot. Simply checking whether memory is free,
reserved or committed and summing the respective types reports usages that
are obviously not correct.
Any suggestions on how to identify virtual memory for code, heap and/or stack?
for (addr = 0x10000; addr < 32*1024*1024; addr += (DWORD)RegionSize) {
if (!VirtualQuery((LPCVOID)addr,&mbi,sizeof(mbi)))
break;
if (mbi.State == MEM_FREE)
dwAvailVirtual += (RegionSize -
((~(DWORD)BaseAddress+1)&0xffff)) & 0xffff0000;
}
You can identify some areas of memory by memory map location, or through
some of the tool help apis, but I don't know a generic way to cover all
cases. The code above should work to sum up the slot 0 memory. You'll have
to adapt it to run on different processes/slots.
-Ross
"Bill T" <Bi...@discussions.microsoft.com> wrote in message
news:F914670E-A18A-4349...@microsoft.com...
Thanks for the reply.
My sample code is similar to this but the MEM_FREE sum is way too large and
the MEM_RESERVE and MEM_COMMIT sums are way to low for the processes that I
am monitoring.
"Ross Jordan [MSFT]" <ross.nosp...@microsoft.com> wrote in message
news:4727bcfd$1...@news.microsoft.com...
-Ross
"Bill T" <bil...@charter.net> wrote in message
news:uT8OrzAH...@TK2MSFTNGP05.phx.gbl...