|
Hello everyone,
Sorry that this question is related to another question I posted some time before because I have some new findings and self-analysis.
My question is why sometimes from perfmon on Windows, working set larger than virtual memory? I think virtual memory is the total size of memory (committed, reserved, shared, private) and working set is just the RAM touched by current process currently. Virtual memory should always larger than working set...
But, I write a simple program to show working set is larger than virtual memory from perfmon. The program is simple, just open a couple of memory map files and read from beginning to the end.
The only reason I could think of why working set sometimes is larger than virtual memory is, the OS memory management component may not reclaim some RAM consumed by current process even if the current process does not use the RAM. And keeping such RAM could improve performance if the process will use it in the future. But this point makes me confused because I think if it is true, such RAM does not have related virtual memory address, how could the current process utilize or even address (re-use to avoid hard page fault) it in the future?
thanks in advance,
George
|
|
|
|
|
Perhaps you have the wrong idea about the Virtual Memory figure in perfmon. Perhaps it only records memory that has actually been VirtualAlloc ed at some point without including directly heap allocated memory like that which I guess is used for the memory mapped files. The complete process memory map for a Win32 process, even pre .NET, is a complex beast with potentially multiple heaps, Virtual allocations in their various states, a stack per thread, a TLS block per thread, non paged pool, kernel object storage, COM CoTaskAlloc ed memory and whatever marshalling uses and some other wierd stuff that the C Runtime does way down in the bowls with functions like calloc .
Probably you should do some in depth research and the write an article for Code Project laying all this stuff out and relating it to what we see in perfmon.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Matthew Faithfull wrote: Probably you should do some in depth research and the write an article for Code Project laying all this stuff out and relating it to what we see in perfmon.
I think he collected material for many, many articles.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Hi CPallini,
Without you guys help, I can not collect so many information.
have a good weekend,
George
|
|
|
|
|
Thanks. But:
You gotta get an article out, you owe it to the people.
We're so happy we can hardly count.
Happy weekend to you.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
modified on Saturday, January 12, 2008 10:35:05 AM
|
|
|
|
|
Thanks for sharing your points, Matthew!
But I do not quite agree with you, since on Windows, from memory management concept point of view, virtual memory (either allocated) contains all the memory of the current process, and new/malloc eventually maps to locations in virtual memory space, right?
So, I am not sure whether you points -- memory allocated through VirtuaAlloc is on virtual memory, and memory allocated by new/malloc is not on virtual memory.
If I am wrong, please feel free to comment.
Any more ideas? Maybe we could write some simple programs to verify our ideas? Any ideas?
regards,
George
|
|
|
|
|
George,
What does any of this have to do with C++/MFC?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Sure, DavidCrow.
I am studying why my application consumes too much memory on working set -- larger than virtual memory.
regards,
George
|
|
|
|
|
|
stop reposting again and again !
this is not a chat, its a forum. when you ask a question at midday, keep in mind that it's midnight at the other side of the earth.
so if you want relevant answers, BE PATIENT.
so abusing the forum is the best way to make people ignore you and your question.
if anyway you still don't get any answers, maybe it's because you don't ask it correctly...
read the posting guidelines then.
|
|
|
|
|
toxcct wrote: keep in mind that it's midnight at the other side of the earth.
probably still think the earth is flat.
|
|
|
|
|
so what ?
it isn't ??
|
|
|
|
|
|
CPallini wrote: I felt myself a very important person
welcome in the MVP club
|
|
|
|
|
CPallini wrote: Someone (can you guess who was?) voted you down 1, then I voted you up 5
Hey every MVPs got voted down on this page !!
so i voted you 5 here... please do what you have to do ^^
|
|
|
|
|
Thanks buddy,
toxcct wrote: Hey every MVPs got voted down on this page !!
but, really, should we care about?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
CPallini wrote: but, really, should we care about?
how do you think the MVP is awarded ?
BTW, don't forget me
|
|
|
|
|
I will help you guys out. I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
rotfl.
buying $10k for this
|
|
|
|
|
I'll let you know when I've finished. Certain CP members will recieve free, limited edition devices, with customizable branded fists to combat ignorance here at the forums.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Call it the Chuck Norris Voting machine.
|
|
|
|
|
toxcct wrote: how do you think the MVP is awarded ?
Well I don't know exactly.
Anyway, if MVP is so troll-vote-sensitive, then IMHO nobody should care about MVP.
toxcct wrote: BTW, don't forget me
My 5 to you.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Sorry to disturb: I had to vote you a 1 here solely for test reasons.
I gave you a 5 on this one[^] in return.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Quit re-posting your freaking question. People have tried to help you, numberous times. You simply don't have a good skill-base to even attempt to do what you are trying to do. QUIT RE-POSTING. I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
SDI, I have a modal dialog when program start, and want to give users a chance to open a file here, but I can't call CWinApp::OnFileOpen directly.
Whether a file is opened successfully should be known.
Thanks.
|
|
|
|