Jump to content
  • Advertisement
Sign in to follow this  
myvraccount

Problem with PagedMemorySize64

This topic is 524 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm using C#, and trying to figure out how much memory a process is using within the paging file or how much of its memory within physical RAM can be moved to the paging file if necessary.

 

Unless I'm mistaken (and I might be), the function PagedMemorySize64 is supposed to tell me how much is currently in the paging file, and PagedSystemMemorySize64 should tell me how much is in RAM but could be moved into the paging file at any time.

 

If those assumptions are correct, then so far so good.

 

However, even when "No paging file" is checked within my Virtual Memory properties window, these two functions both return positive numbers!  Why would that be?

 

Also, I opened the "Performance" tab on the Windows Task Manager, and in the section called "Kernel Memory (MB)" it says that "Paged" is a positive number (a pretty small number like in the hundreds, but I don't know if it's counting pages or bytes or what).

 

Am I imagining things, or is my computer actually using a paging file even when I tell it not to, or alternatively, do those paged memory size 64 functions not work or just not do what I think they do?

Share this post


Link to post
Share on other sites
Advertisement

Not a Beginners topic. Also, not relevant to games. Do you have an explanation for why you're asking this on Gamedev.net?

Share this post


Link to post
Share on other sites

OK then I guess like the other one, it should go in the General Programming forum.  That's "General" enough for it, right?  And how do you know it's not relevant for games anyway?  People save games in files all the time.  I'm really not trying to be snide, but just making a point.

Share this post


Link to post
Share on other sites

Here's the situation: not everything on these forums has to be 100% about game development, but it should at least be potentially relevant. Maybe because you're using it in a game context, or someone else would. Maybe because it uses techniques or technology used in game development. Or maybe the answer might tell us something about how to better make games or how to improve our programming.

Your last few threads have only had the most tenuous link to games development, made worse by your refusal to explain what you are doing or why you are doing it. "I'm having trouble with file code that I can't show you, in an app I won't tell you about, while doing weird things with virtual memory, but since games also use files it's relevant" is not a compelling response.

And it's not a one-off - it seems to be the case for all your threads these days. If you just want to continue asking off-topic questions, Stack Overflow is probably the best place for you. But if you'd prefer to keep posting here, show us how this is on-topic.

Share this post


Link to post
Share on other sites

OK sorry, but you don't have to close my threads like you just did with the other one.  I mean if you don't want to answer my question that's your business, but when you close it you prevent anyone else from possibly being able to answer it, even if they would have!

Oh, and also, if the "General Programming" must be about games then why is it called "General Programming"?

Share this post


Link to post
Share on other sites

As a moderator it's part of my job to keep these forums clear of irrelevant clutter. Keep your threads relevant and they won't be closed.

For the answer to your last question, please consult the first paragraph of my last response.

Share this post


Link to post
Share on other sites

Trying to address the original question ...

You need to do some reading to gain a much deeper understanding of how virtual memory works.  The last several questions on the topic show you have done almost no research, instead you just reach for likely-sounding names in the API and assume they do what you think they do rather than what they actually do.

PagedMemorySize64() documentation says it gives the value "Page File Bytes". That is private committed memory, which (if you have done your research you would know) is pageable memory your process owns and that you have written on. That is different from pageable memory your process owns but has not been committed.  None, some, or all of it may be located in a paging file. 

The system memory call is similar.

Share this post


Link to post
Share on other sites

Okay so just to actually answer this even if its not game related (will agree its more akin to something that should be on stack overflow) - but may as well get an answer.

Your assumptions on how they work are for the most part correct, however the PagedMemorySize64 will return a value even if page file size is set to 0 or its not using a page file - as stated by Microsoft on their docs "The property value is equivalent to the Page File Bytes performance counter for the process."

Which if you read into will show you that it returns the amount of virtual memory being used for paging files HOWEVER if there is no paging file it will show the amount of virtual memory that the process has reserved in physical memory.

So even with paging files set to 0 on usage, it will still return a value.


There, question answered so you dont have to re-post to stack overflow - #LockThreadKylo

But seriously, threads should be game related and I feel bad for answering this :( 

Share this post


Link to post
Share on other sites

Well thanks then GibbonThatCodes.  At least that tells me that I must be using the wrong function for what I'm trying to do, but I guess I'll still have to post to Stack Overflow or something to figure out which function I should use.

Share this post


Link to post
Share on other sites

An alternative is to go read the documentation of the C# library. No doubt it's a lot, so you won't know it all in one hour or even one evening, but the global picture of the kind of things that exist there will stick.

If you do that a few times, you start to know where to look more precisely. In a few months, you know all the relevant major things from that library without ever needing to ask or search.

While I agree that it is not the fastest way at first, assuming you will be programming for many many years, I do think your investment will pay for itself several times during your career, at least it did for me in several languages.

Share this post


Link to post
Share on other sites

This topic is 524 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!