Viewing Memory Allocation in VS.NET

Started by
2 comments, last by StaticEngine 19 years, 3 months ago
I feel pretty dumb asking this, but I guess I've never needed to know before: Is there a way to see how much memory your app has allocated when running under the debugger in Visual Studio .NET? Thanks.
Advertisement
Which operating system are you using? Because it appears that you can view the memory allocated to each process in the task manager, in XP.

If you want to know memory that you have allocated threw malloc or new statements, then one way you can approach this is by making a base class (if using C++) and have all your classes derive from that class. In that class if you overide the new operator to keep a static count of the amount of memory allocated, then you can simply watch this variable in the debugger, or if you like print it out to the screen.

If you don't want to do this, because your codes too complicated, you may be able to use the _heapwalk function or something equivalent to walk through each block on it's heap and test it's size.
Windows Task Manager is quite good for that kind of stuff. ;]

If that is to easy, just call GetProcessMemoryInfo to get the info.

And if that's to easy, use function in crt.h. :)
I didn't even think to look at the Task Manager. It's good to know about GetProcessMemoryInfo() though.

Yeah, I'm trying to see how much memory is allocated by different STL containers. I've got my speed stats, now I just need storage numbers.

Thanks.

This topic is closed to new replies.

Advertisement