Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Why does my workingsetsize always equal 0?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Kun Niu  
View profile  
 More options Apr 30 2008, 8:58 am
Newsgroups: microsoft.public.win32.programmer.kernel
From: Kun Niu <Kun...@discussions.microsoft.com>
Date: Wed, 30 Apr 2008 05:58:00 -0700
Subject: Why does my workingsetsize always equal 0?
Dear all,
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.
Then I try to get the value in a separate thread.
But I get the same result.
Workingsetsize always equals to 0.
So will anyone please help me so that I can implement the functionality like
windows task manager with a process memory usage shown to me?
Thanks for any advice in advance.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Lowndes  
View profile  
 More options Apr 30 2008, 1:55 pm
Newsgroups: microsoft.public.win32.programmer.kernel
From: David Lowndes <Dav...@example.invalid>
Date: Wed, 30 Apr 2008 18:55:43 +0100
Local: Wed, Apr 30 2008 1:55 pm
Subject: Re: Why does my workingsetsize always equal 0?

>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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kun Niu  
View profile  
 More options May 1 2008, 8:58 am
Newsgroups: microsoft.public.win32.programmer.kernel
From: Kun Niu <Kun...@discussions.microsoft.com>
Date: Thu, 1 May 2008 05:58:01 -0700
Local: Thurs, May 1 2008 8:58 am
Subject: Re: Why does my workingsetsize always equal 0?

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.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Lowndes  
View profile  
 More options May 1 2008, 9:05 am
Newsgroups: microsoft.public.win32.programmer.kernel
From: David Lowndes <Dav...@example.invalid>
Date: Thu, 01 May 2008 14:05:29 +0100
Local: Thurs, May 1 2008 9:05 am
Subject: Re: Why does my workingsetsize always equal 0?

>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.

Why?

Dave


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kun Niu  
View profile  
 More options May 1 2008, 10:21 am
Newsgroups: microsoft.public.win32.programmer.kernel
From: Kun Niu <Kun...@discussions.microsoft.com>
Date: Thu, 1 May 2008 07:21:01 -0700
Local: Thurs, May 1 2008 10:21 am
Subject: Re: Why does my workingsetsize always equal 0?

"David Lowndes" wrote:
> >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.

> Why?

> Dave

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.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Lowndes  
View profile  
 More options May 1 2008, 10:52 am
Newsgroups: microsoft.public.win32.programmer.kernel
From: David Lowndes <Dav...@example.invalid>
Date: Thu, 01 May 2008 15:52:18 +0100
Local: Thurs, May 1 2008 10:52 am
Subject: Re: Why does my workingsetsize always equal 0?

>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.

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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Voigt [C++ MVP]  
View profile  
 More options May 1 2008, 2:21 pm
Newsgroups: microsoft.public.win32.programmer.kernel
From: "Ben Voigt [C++ MVP]" <r...@nospam.nospam>
Date: Thu, 1 May 2008 13:21:13 -0500
Local: Thurs, May 1 2008 2:21 pm
Subject: Re: Why does my workingsetsize always equal 0?

Kun Niu wrote:
> "David Lowndes" wrote:

>>> 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.

>> Why?

>> Dave

> Thanks again for your attention and fast reply.
> This is also what I'm after.
> No error box arises before my program terminates.

Sounds like either stack overflow or intentional shutdown.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google