What's the Best Way to Measure Memory Use from a Program?

I've been trying to optimize the Windows program I am developing, trying to find the best data structures that will minimize memory use. It loads large blocks of data, so with huge files, it can use a large amount of RAM.

For memory measurement, I have been using GlobalMemoryStatusEx. See: http://msdn.microsoft.com/en-us/library/aa366589(VS.85).aspx

I believe this works for most flavors of Windows, from Windows 2000 right up to and including Windows Vista.

Is this the preferred way to measure memory use from within a program, or is there another, better way?


Addenum: Found the Stackoverflow question: How to get memory usage under Windows in C++ which references GetProcessMemoryInfo

I'll try that one out.

Answers


If you are trying to optimize your own program memory-wise, I suggest you use a memory profiler tool for that. There are many out there...some are free, some are not..you will surely find the one you need. Those tools are written specifically for what you need (and also for memory leaks search) so...it will be hard to compare with them and do something like that on your own from your own program :)


See the addenum in my question.


Need Your Help

Setting the options from the list selected using JQuery

jquery jquery-selectors drop-down-menu

I have a <select></select> now the list contains some option like a, b, and c now i want that when user enters a in textbox and click button a should be selected in select list, and

Is it possible to create a limited registration signup form using Google Docs Forms?

forms google-docs google-apps-script

I would like to create an event signup form using Google Docs. The user is able to select which session they would like to attend, but I need to somehow limit the number of people that can register...