Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Newbit type question about Memory Use/Leaks and Process Viewer

Newbit type question about Memory Use/Leaks and Process Viewer
Thread Tools
msykes
Senior User
Join Date: Mar 2001
Location: Bay Area, CA
Status: Offline
Reply With Quote
Nov 5, 2002, 03:12 AM
 
So first a little history: my Ti800DVI recently has become really slow, hard drive spinning constantly, until finally I got an "out of memory" type error which popped up, and sure enough my hard drive was full. I deleted a couple things (about 2 gigs worth), rebooted, and suddenly I had 25 gigs free.

Since I've recently been doing some work developping my own applications, I suspected a memory leak in one of my apps might have contributed to this over an extended period.

Can someone answer the following questions:

1. Suppose I do have a memory leak in a program; I was under the impression this memory would be freed back to the system when the program terminates, is this correct?

2. What if the application crashes? Does the memory still get freed?

3. I found "MallocDebug" and "ObjectAlloc", in the developer tools, both of which would seem to be good tools to help if there is a leak. The former didn't work with my app for some reason, but the latter did. As a simpler place to start though I thought I'd check out "Process Viewer". For every app it lists two memory stats; a) Virtual Memory Size and b) Resident Memory Size.

a) seems self explanatory, is b) the amount of actual physical RAM being used? I imagine that if I had a memory leak, and my app kept allocating more and more memory it would show up here. Is this true? Can I use these numbers to track my apps overall memory footpring over time, or is there some kind of memory allocation that Process Viewer misses?


Okay, I think that's enough questions to start, thanks for any help on this one.
( Last edited by msykes; Nov 5, 2002 at 02:03 PM. )
     
Mactoid
Grizzled Veteran
Join Date: Sep 2000
Location: Springfield, MA
Status: Offline
Reply With Quote
Nov 5, 2002, 11:21 PM
 
Originally posted by msykes:
...Can someone answer the following questions:
I'll do my best, though there are far more qualified folks on these boards
1. Suppose I do have a memory leak in a program; I was under the impression this memory would be freed back to the system when the program terminates, is this correct?
Yes
2. What if the application crashes? Does the memory still get freed?
Yes, the kernel will still reclaim any memory that app was using.
a) seems self explanatory, is b) the amount of actual physical RAM being used? I imagine that if I had a memory leak, and my app kept allocating more and more memory it would show up here. Is this true? Can I use these numbers to track my apps overall memory footpring over time, or is there some kind of memory allocation that Process Viewer misses?
I'm fairly sure that you can use these numbers. I've used them before. The apps that come with the dev tools are more specialized apps for monitoring specific types of memory allocation I think. They may or may not be more useful to you. I have not used these programs though myself, so i can't speak authoritatively on them. Hope this is somewhat helpful and accurate
We hope your rules and wisdom choke you / Now we are one in everlasting peace
-- Radiohead, Exit Music (for a film)
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 11:03 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,