peak memory usage

R

Rares Vernica

Hi,

What is the right way/tool to find the peak memory usage of a C++ program?

I tried Valgrind but is does not seem to be able to answer my question.

Thanks a lot,
Ray
 
I

Ian Collins

Rares said:
Hi,

What is the right way/tool to find the peak memory usage of a C++ program?
Either do it yourself with a custom allocator, or use whatever tools
your operating environment provides.
 
R

Rares Vernica

Ian said:
Either do it yourself with a custom allocator, or use whatever tools
your operating environment provides.

Can you please name a few tools? I am using Linux.

I know "top" shows the memory usage, but it shows it in real time and it
is difficult to get the peak.

Thanks,
Ray
 
I

Ian Collins

Rares said:
Can you please name a few tools? I am using Linux.
I prefer the custom allocator approach, as for tools, you should ask on
a Linux development group or comp.unix.programmer.
 
M

Michael Oswald

Can you please name a few tools? I am using Linux.


IIRC memusage. Puts out a log or even a png graphic with the memory
usage. Used it a lot some time ago for debugging purposes


Michael
 
F

Fei Liu

Rares said:
Hi,

What is the right way/tool to find the peak memory usage of a C++ program?

I tried Valgrind but is does not seem to be able to answer my question.

Thanks a lot,
Ray
You didn't try valgrind hard enough, search 'messif'. Valgrind does give
you detailed memory usage. Why wouldn't it? All your memory
allocation/deallocation are detoured through valgrind.

Fei
 
J

Jacek Dziedzic

Rares Vernica wrote:
I know "top" shows the memory usage, but it shows it in real time and it
is difficult to get the peak.

Well, "man top" says top has batch mode operation, perhaps you could
use that?

</OT>
 
R

Rares Vernica

Fei said:
You didn't try valgrind hard enough, search 'messif'. Valgrind does give
you detailed memory usage. Why wouldn't it? All your memory
allocation/deallocation are detoured through valgrind.

Fei

I especially tried Massif.

Quote from the Valgrind mailing list:

"> I would like to know just the size of the memory my program is using.
>
> No. That's the total allocated. You want the peak, I presume.
>
>
> You can't, unfortunately.
>
> ---

Not without modifying Massif.
"

Ray
 
R

Rares Vernica

Jacek said:
Rares Vernica wrote:


Well, "man top" says top has batch mode operation, perhaps you could
use that?

</OT>

Even in batch mode, I would need to run top exactly when the memory
usage in my program is at peak.

Thanks,
Ray
 
R

Rares Vernica

Michael said:
IIRC memusage. Puts out a log or even a png graphic with the memory
usage. Used it a lot some time ago for debugging purposes


Michael

memusage seems to do the job.

Thanks a lot,
Ray
 
M

Michael Ekstrand

Not without modifying Massif.

If memory serves correctly, Massif produces a plot of memory consumption
over time. Would that get you at least close enough to what you need?

- Micchael
 
R

Rares Vernica

Michael said:
If memory serves correctly, Massif produces a plot of memory consumption
over time. Would that get you at least close enough to what you need?

- Micchael

Yes, you are correct, it produces a plot, but is difficult to get the
peak exactly.

Thanks,
Ray
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top