I'm a newbie in this place and starter with C# mobile. Now , I'm working on C# handheld device platform. So , I have some question to ask about how to get the memory usage. I have try GC.GetTotalMemory() and get the allocated memory that the GC used. But , Can I use this to estimated that how much my application was allocated the memory. I suppose that it may be but not actual correct. Then I've try google to searching for any reference or class or anything to use for checked the memory on windows CE but I've found only in another platform that not supported with the thing I'm doing.
Thanks in advance , Stoper
Apologize for that I gone away from this post.
I'm really thank you to anybody who've answer my question and watch on this post.
Now , I got all that I need by implement the "OpenNetCF" reference in my project.
Thanks again ;)
According to the docs, GC.GetTotalMemory
returns
A number that is the best available approximation of the number of bytes currently allocated in managed memory.
This is a bit misleading/confusing to some devs, especially those coming from a native world. It's going to tell you how much memory the GC has allocated internally but not what its actual allocation for the whole heap (i.e. allocated and unallocated managed memory) from the system is.
It also doesn't report native allocations. This can be huge if you use a lot of GDI objects (bitmaps, brushes, etc) as those have native memory allocations as well. In teh case of a Bitmap, it's managed footprint is actually much smaller than its native footprint.
If you're interested in your managed apps actual impact on the overall system resources, you need to query the OS and ask how much physical and virtual memory it has to get an actual feel for what's going on (I find GC.GetTotalMemory to be relatively useless in fact). P/Invoking GlobalMemoryStatus gives you what you want. MSDN contains an example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With