Virtual memory usage of a process in c++
-
GlobalMemoryStatus http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/globalmemorystatus.asp[^]
John
Thanx john :) Its a total size of virtual memory allocated to a process but i want virtual memory currently being used by the process. Do you knows anything about how can i get that information??
Manish
-
Thanx john :) Its a total size of virtual memory allocated to a process but i want virtual memory currently being used by the process. Do you knows anything about how can i get that information??
Manish
Total usedVirtual for a proccess = dwTotalVirtual - dwAvailVirtual;
John
-
Total usedVirtual for a proccess = dwTotalVirtual - dwAvailVirtual;
John
Thanx John :) I think that ll solve my querry...
Manish
-
Thanx john :) Its a total size of virtual memory allocated to a process but i want virtual memory currently being used by the process. Do you knows anything about how can i get that information??
Manish
If you can not get the information from GlobalMemoryStatus that you need you can also use VirtualQuery which will allow you to count all used memory blocks in a programs addresss space yourself. I actually have a need for both in the appilcations I write because of address space fragmentation the total amount of virtual memory free for a process may not be the amount of memory I can allocate given that I am allocating 16 to 60MB buffers. BTW - I can give you an example code on this when I get to work if you need.
John
-
Hi all, Can anyone knows how can i get virtual memory usage of a process in my c++ code,any api?? I am able to get physical memory usage of process in my code but not able to get information about virtual memory :doh: :doh: Any help??
Manish
-
If you can not get the information from GlobalMemoryStatus that you need you can also use VirtualQuery which will allow you to count all used memory blocks in a programs addresss space yourself. I actually have a need for both in the appilcations I write because of address space fragmentation the total amount of virtual memory free for a process may not be the amount of memory I can allocate given that I am allocating 16 to 60MB buffers. BTW - I can give you an example code on this when I get to work if you need.
John
Hi John, I m satisfied with the virtual memory usage shown by GlobalMemoryStatus function previously i had used that function but it gives me a look of total virtual memory allocated to all running proceses. VirtualQuery needs Pointer to the base address of the region of pages to be queried from where i can get that? Coz i haven't allocated virtual memory by VirtualAlloc. As u said you have a sample example of ur own may be it will help a little. Thanx :)
Manish
-
Hi John, I m satisfied with the virtual memory usage shown by GlobalMemoryStatus function previously i had used that function but it gives me a look of total virtual memory allocated to all running proceses. VirtualQuery needs Pointer to the base address of the region of pages to be queried from where i can get that? Coz i haven't allocated virtual memory by VirtualAlloc. As u said you have a sample example of ur own may be it will help a little. Thanx :)
Manish
Do you still need this? I can email you this as it is too long to post here.
John
-
Do you still need this? I can email you this as it is too long to post here.
John
Thanx John! For the time i don't need to look on virtual memory usage but may be in future i required that. U can mail me at mmanish3214@rediffmail.com :)
Manish
-
Thanx John! For the time i don't need to look on virtual memory usage but may be in future i required that. U can mail me at mmanish3214@rediffmail.com :)
Manish
The problem with the code I promsed you is that it is part of a dll (that has over 50K lines of code) and uses a few other classes of the dll. For your purpose these are not necissary so giving you this code requires a little bit of cleanup which I have no problem doing however I am seriously behind a deadline at work. I have been working 12 hour days and although I really try to help others I really can't find the time. Sorry but I will get back to this I promise.
John
-
The problem with the code I promsed you is that it is part of a dll (that has over 50K lines of code) and uses a few other classes of the dll. For your purpose these are not necissary so giving you this code requires a little bit of cleanup which I have no problem doing however I am seriously behind a deadline at work. I have been working 12 hour days and although I really try to help others I really can't find the time. Sorry but I will get back to this I promise.
John
No probs John!!! I required that just for an alternative to my previous code,whenever u get time do that or evenif not posible dnt worry i got my problem solved.
Manish