0

Whats the meaning Memory Profiling?

Is it give statistics of memory like how much memory utilized?

And are there any different kinds in this?

Bhavesh Odedra
  • 10,990
  • 12
  • 33
  • 58
  • for example, if you're debugging an application and this application allocates memory to create structures or de-allocated memory to release unused structures, you may want to know what structures are using how much memory and you may want to monitor this information in real-time, for example, to avoid consuming all the available memory due to a programming bug. – Leo May 01 '15 at 05:24
  • http://en.wikipedia.org/wiki/Profiling_%28computer_programming%29 – Leo May 01 '15 at 05:26

1 Answers1

0

The problem is, you may be doing way to much new-ing which, even in a language with a garbage-collector, may unnecessarily dominate your execution time. You may also have a memory leak meaning that the amount of dynamic memory you're not returning to the pool grows steadily over time. If your app runs for a long time, that's equally bad.

I use the random-pausing method for performance diagnosis, but that is of no value for finding memory leaks. That's what Memory Profiling should help with.

Here's how I've found memory leaks in the past, using MFC. In a debug build, when I shut down the app, it prints a list of all the non-collected memory blocks, along with their class type. Then I look to see where those blocks are created, and try to figure out why they weren't deleted or collected. It would be more useful if I could capture a stack trace on each block, so I could tell which new statement made it, and the stack could tell me why. The point is, I could allocate 100 blocks of class Foo, and delete 99 of them. The one that I don't delete is the problem, so it would be useful to know more about where it came from. I don't know if memory profilers can do this or not.

Community
  • 1
  • 1
Mike Dunlavey
  • 40,059
  • 14
  • 91
  • 135