"David Lowndes" wrote:
> >I'm trying to use GetProcessMemoryInfo to get the workingsetsize of my
> >process.
> >The function is called in my own process, so I think that I've got all the
> >privileges.
> >The program is written with multithread.
> >And I create a timer to periodically get workingsetsize of my process.
> >But to my surprise, no matter I put the PROCESS_MEMORY_COUNTERS variable
> >locally in the function or I set the PROCESS_MEMORY_COUNTERS variable as
> >global, I alway get 0 after I call GetProcessMemoryInfo in the timer callback
> >function.
> 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.