none
monitor memory usage in C++ code

    Question

  •  

    Hi,

     

    I am writing a native C++ code that takes up a lot of memory. Is there a tool or a method to monitor where my memory is getting allocated? I am looking for something like a profiler that tells me which functions take up most of memory.

     

    An alternative method that would be very helpful would be to step through the code and look at some good memory monitoring program/function that would tell me how much memory I allocated as I step through my higher level routines.

     

    Any pointers would be appreciated.

     

    Thanks

     

    PS: I am using Visual Studio 2005 on Windows 2000 Professional.

    Saturday, October 27, 2007 6:17 PM

Answers

  • I do not know of any integrated way of doing it (I have not done that many projects with 2005 yet though), however, usually you use profiling applications in order to determine things like this, one example would be:

    • AQtime
      Saturday, October 27, 2007 6:35 PM

      All replies



      • I think you can use BoundsChecker  or either Rational Purifier to detect memory leak in your Program.
        Thanx
        Saturday, October 27, 2007 6:20 PM
      • I do not know of any integrated way of doing it (I have not done that many projects with 2005 yet though), however, usually you use profiling applications in order to determine things like this, one example would be:

        • AQtime
          Saturday, October 27, 2007 6:35 PM
        • Hi Pintu,

           

          We have Rational Purify with us but my problem is not a memory leak.

           

          My application just takes up too much memory.. I just want to know which functions or portions of my code are allocating all the memory that is in use when the program is running. So I can change my strategy there and maybe compute some values instead of storing them.

           

          I don't know if Purify can act like a memory profiler also. I will check though.

           

          Thanks,

          Sachin

          Sunday, October 28, 2007 5:52 PM
        •  

          Hi Andreas,

           

          AQTime looks like a very interesting tool. I am going to download it and give it a try.

           

          Thanks!

          Sachin

          Sunday, October 28, 2007 6:00 PM
        • Hi there.
          Did you manage to do it with AQTime ? Because I am also interested in C++ memory usage (not leaks) and I haven't found a tool that could do this for me.


          Thursday, January 03, 2008 7:29 PM
        • Hi,

           

          AQTime looked useful, but we couldn't give it a fair shot to come to a decision in a month (trial period). It gives details of which objects are taking up how much memory, but didn't really help us identify how best to minimize our memory usage. We were expecting something on the lines of Rational quantify analysis and AQTime really falls short of that.

           

          In the end what we did was to go through all our classes and count the number of bytes we are allocating per object and then run some cases to determine the number of objects of each class and just summed them together. I know this is quite primitive and painful, but still gives a rough estimate.

           

          Thursday, January 03, 2008 8:47 PM