How can I get the memory usage for a process in Windows
CE? I've tried with CreateToolhelp32Snapshot and
enumerated heaps, but it's hard to tell whether the
number I get is correct. Is there a better way?
I've googled to find a task manager sample or similar
illustrating this, but no luck.
In addition to allocated memory
(CreateToolhelp32Snapshot) I assume I need to include
the .exe's size to get a good value (?) unless it's
executed in place.
Is there a way to programatically detect if a binary is
executed in place?
I hope someone can give some help.
Thanks in advance
Nisse
Using CreateToolhelp32Snapshot and then Heap32First, etc to walk a heap
helps you determine heap usage, but that's hardly the full story in terms of
memory usage. Memory that is virtual alloc'd (app and dll code, thread
stacks, heap usage, direct calls to VirtualAlloc, and even toolhelp
snapshots) is truly your application's memory usage. You can get that from
a single call to GlobalMemoryStatus().
You can use GetFileAttributes() to determine is an application or DLL file
is XIP. If it has FILE_ATTRIBUTE_ROMMODULE, it is. But you still count
it's footprint in the memory usage for that particular process.
--
Michael Salamone [eMVP]
Entrek Software, Inc.
www.entrek.com
"Nisse" <anon...@discussions.microsoft.com> wrote in message
news:03a701c3c034$a71cc9e0$a401...@phx.gbl...
GlobalMemoryStatus gives me the system's memory. Is there
no way to get per process data? Similar to what the task
manager shows in Windows XP?
>.
>
dwTotalVirtual
Indicates the total number of bytes that can be described in the user mode
portion of the virtual address space of the calling process.
dwAvailVirtual
Indicates the number of bytes of unreserved and uncommitted memory in the
user mode portion of the virtual address space of the calling process.
What else do you want? You can do your own virtual memory walking using
VirtualQuery. It's what GlobalMemoryStatus does, though.
--
Michael Salamone [eMVP]
Entrek Software, Inc.
www.entrek.com
"Nisse" <anon...@discussions.microsoft.com> wrote in message
news:03b901c3c4e7$f95a73d0$a401...@phx.gbl...