how can i measure the memory that program use

R

remlostime

now, i wanna how much memory my program use, what code should i add to
my code, or is there some program that can test it?
 
C

cc

now, i wanna how much memory my program use, what code should i add to
my code, or is there some program that can test it?

I also want to know, mark. So waiting someone settle this problem
 
M

Michael Ekstrand

remlostime said:
now, i wanna how much memory my program use, what code should i add
to my code, or is there some program that can test it?

How you can do that is usually platform-specific and can be
complicated (e.g., on some platforms there isn't a nice number you can
look at and say "there, that's how much memory it uses!").

Your best option is probably to use a memory profiler such as the
Massif heap profiler that comes with Valgrind or the one in Apple's
development tools. A newsgroup or discussion forum specific to
development for your operating environment would be the appropriate
place to seek more information on the subject.

- Michael
 
R

remlostime

How you can do that is usually platform-specific and can be
complicated (e.g., on some platforms there isn't a nice number you can
look at and say "there, that's how much memory it uses!").

Your best option is probably to use a memory profiler such as the
Massif heap profiler that comes with Valgrind or the one in Apple's
development tools. A newsgroup or discussion forum specific to
development for your operating environment would be the appropriate
place to seek more information on the subject.

- Michael

i'm using fc7
 
I

Ian Collins

remlostime said:
now, i wanna how much memory my program use, what code should i add to
my code, or is there some program that can test it?

Create your own global new and delete operators and keep track your self.
 
R

remlostime

top

What you care about is probably RSS or RES, the "resident set size."

I dont know what the difference between them, actually i wanna know
can i insert some code to my program and when it
ends it will show the sum of used memory
 
J

Jeff Schwab

remlostime said:
I dont know what the difference between them, actually i wanna know
can i insert some code to my program and when it
ends it will show the sum of used memory

Not without some help from a separate profiling tool. Check out
valgrind (pronounced "Val grinned").
 

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,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top