Is the timer or separate thread significant - what do you get if you
call it from your main thread?
The following snippet works for me in a console application:
PROCESS_MEMORY_COUNTERS mc;
if ( GetProcessMemoryInfo( GetCurrentProcess(), &mc, sizeof(
mc ) ) != 0 )
{
printf( "%WorkingSetSize: %d\n", mc.WorkingSetSize );
}
Dave
Thank you for your reply.
It's true that I try to call the function in my main function.
It returns the write number.
But after that, my program aborted abnormally.
So, I'll have to try to get the value in another thread or in a timer
callback function.
Thanks again for your attention and reply.
Why?
Dave
"David Lowndes" wrote:
Thanks again for your attention and fast reply.
This is also what I'm after.
No error box arises before my program terminates.
Now I have to write another program and record the workingsetsize.
Just wonder why the program can't get its own workingsetsize correctly.
Or do I have any other way to work around this?
Get the same result with another API.
Thanks for any attention and reply in advance.
If I were you I'd first check that the relevant piece of code to get
the value works in a simple example project. Once you've done that you
need to pinpoint the cause of the apparently catastrophic problem in
your real application - I can't see any reason why your application
shouldn't be able to get the value successfully.
Dave
Sounds like either stack overflow or intentional shutdown.