473,382 Members | 1,665 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

peak memory usage

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
Mar 21 '07 #1
11 5909
Rares Vernica wrote:
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.

--
Ian Collins.
Mar 21 '07 #2
Ian Collins wrote:
Rares Vernica wrote:
>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.
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
Mar 21 '07 #3
Rares Vernica wrote:
Ian Collins wrote:
>Rares Vernica wrote:
>>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.

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.

--
Ian Collins.
Mar 21 '07 #4
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

Mar 21 '07 #5
Rares Vernica wrote:
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
Mar 21 '07 #6
Rares Vernica wrote:
<OT>
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>
Mar 21 '07 #7
Fei Liu wrote:
Rares Vernica wrote:
>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
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.
Does the following information from memcheck answer my question?

==14776== malloc/free: 594,317 allocs, 594,317 frees, 15,403,721 bytes
allocated.

No. That's the total allocated. You want the peak, I presume.
If not, how can I compute the total memory usage from this massif
output:
>
==14494== Total spacetime: 522,204,199,298 ms.B

You can't, unfortunately.

---
Yes, I would like to know the peak.

Is there a way to find it out?
Not without modifying Massif.
"

Ray
Mar 21 '07 #8
Jacek Dziedzic wrote:
Rares Vernica wrote:
<OT>
>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>
Even in batch mode, I would need to run top exactly when the memory
usage in my program is at peak.

Thanks,
Ray
Mar 21 '07 #9
Michael Oswald wrote:
>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
memusage seems to do the job.

Thanks a lot,
Ray
Mar 21 '07 #10
On Wed, 21 Mar 2007 09:54:46 -0700, Rares Vernica wrote:
If not, how can I compute the total memory usage from this massif
output:
>
==14494== Total spacetime: 522,204,199,298 ms.B
>
You can't, unfortunately.
>
>
---
Yes, I would like to know the peak.

Is there a way to find it out?

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
Mar 21 '07 #11
Michael Ekstrand wrote:
On Wed, 21 Mar 2007 09:54:46 -0700, Rares Vernica wrote:
> If not, how can I compute the total memory usage from this massif
output:
> >
==14494== Total spacetime: 522,204,199,298 ms.B

You can't, unfortunately.

---
> Yes, I would like to know the peak.

Is there a way to find it out?

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
Yes, you are correct, it produces a plot, but is difficult to get the
peak exactly.

Thanks,
Ray
Mar 21 '07 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: rbt | last post by:
Would a Python process consume more memory on a PC with lots of memory? For example, say I have the same Python script running on two WinXP computers that both have Python 2.4.0. One computer has...
2
by: Mike Peretz | last post by:
I am trying to optimize my C# program, but no matter what I try the application keeps eating memory. I verified all the references and even got special software to count references. I made sure all...
2
by: tomvr | last post by:
Hello I have noticed some 'weird' memory usage in a vb.net windows app The situation is as follows I have an app (heavy on images) with 2 forms (actually there are more forms and on starting...
6
by: Tom | last post by:
We have a VERY simple .NET C# Form Application, that has about a 23MB Memory Footprint. It starts a window runs a process and does a regular expression. I have done a GC.Collect to make sure that,...
2
by: Jarvis | last post by:
I've made a testing program to test the memory usage of some Data Forms. I create a MDI parent form with one single MDI child form, which is a Data Form generated by .NET Data Form Wizard. To...
3
by: Ian Taite | last post by:
Hello, I'm exploring why one of my C# .NET apps has "high" memory usage, and whether I can reduce the memory usage. I have an app that wakes up and processes text files into a database...
3
by: Xiangliang Meng | last post by:
Hi, all. In 1998, I graduated from Computer Science Dept. in a university in China. Since then, I've been using C Language for almost 6 years. Although I'm using C++ in my current job, I'm also...
20
by: Philip Carnstam | last post by:
How come .Net applications use so much memory? Every application I compile uses at least 10 MB of memory, even the ones consisting of only a form and nothing else. If I minimize them though the...
1
by: redefined.horizons | last post by:
I was intriuged by the concept of Python Eggs and some of the work that has been done on PEAK. http://peak.telecommunity.com/ However, I think PEAK might be overkill for the particular design...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.