Link to home
Start Free TrialLog in
Avatar of klopter
klopter

asked on

How can I tell where my memory is used?

Is purify the tool that I want?  

I assume that my memory usage is primarily on
the heap (i.e. malloc'd) but I am not 100% familiar
with the code that I am llooking at so I don't
rule out some stack space problem.

Thanks,
  Ken
Avatar of sumant032199
sumant032199
Flag of United States of America image

What does that all mean?
Avatar of klopter
klopter

ASKER

malloc() allocates memory on the heap.
malloc() is used when you don't know
how much memory you will need in advance
and when memory is only needed temporarily.

free() de-allocates memory from the heap.
Every call to malloc() should be
paired with a call to free()
when the space malloc'd is no longer needed.

In C++, new replaces malloc, and
delete replaces free.

Note:  This description is sloppy and
will undoubtably irritate someone.

Ken
What exactly is the problem you are experiencing?
Avatar of klopter

ASKER

Virtual memory size exceeded.

I discovered that I can get more space
by typing "limit datasize 2000M" but
this is only a temporary fix at
some point I am going to have to
figure out exactly where my memory usage
is and whether I have a memory leak.

Ken
R U using a RTOS or any propritery OS, because some systems such as NUCLEUS RTOS gives a variable called first_available_memory which indicates how much memory is left out. In the same way this system calls are propritery to the OS. Just I like to know on which platform you are working.
You can eliminate the stack as a source of your problem by the error you indicated.

What programming platform are you using?
Avatar of klopter

ASKER

My platform is a Compaq true64 Unix or something like that.
ASKER CERTIFIED SOLUTION
Avatar of arjenve
arjenve

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial