• C

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.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

What does that all mean?
klopterAuthor Commented:
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.

What exactly is the problem you are experiencing?
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

klopterAuthor Commented:
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.

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?
klopterAuthor Commented:
My platform is a Compaq true64 Unix or something like that.
I don't know if purify is available for
this platform...
If you have the source code for your
program you can try out
dmalloc (http://www.dmalloc.com/)
it is free, and it can keep
a detailed log of all malloc and
free calls ( including strdup etc.)
I do not know if it runs on a 64bit platform


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.