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 > memory leak from hell... please help

memory leak from hell... please help
Thread Tools
Fresh-Faced Recruit
Join Date: Feb 2003
Status: Offline
Reply With Quote
Feb 3, 2003, 01:57 PM
 
This is in reference to the pr0n app...

pr0n0wnsk7 is a standard NSDocument-based app; the document's controller (subclassed NSWindowController) is what allocates and initializes the perl script, then releases it all so it can be initialized and run again. I noticed a vexing memory leak when I was watching my app using top... it seems that if I closed a session window where I had NOT run the script, the controller would receive a WindowShouldClose notification, then the document and controller would deallocate with no problem (I peppered my code with NSLogs to see what was going on). Whereas when I have run the script, the app goes so far as to deallocate the perl task, throws a WindowShouldClose message, closes the window, but does NOT release the document or the controller, thus clogging up my precious RAM. What's odd is that at the point "WindowShouldClose" I NSLog the current reference count of my document class, and it comes out the same both times - one... yet in one case it releases, and in the other, not. WTF?

Here's the chain in any case:

windowDidLoad
setArgs
initScript
startScript
endScript (this releases everything declared in initScript, startScript, and setArgs... enough so that I can reinitialize and start up the script from scratch with new parameters without a problem)

Something is getting retained somewhere that is muching up the whole works... I'll try to post some of the source later but I'm not at my main computer right now. Any ideas?
     
Fresh-Faced Recruit
Join Date: Feb 2003
Status: Offline
Reply With Quote
Feb 3, 2003, 02:18 PM
 
fixed it... looks like I was removing an observer wrong.

hrmph....

bOH!
     
   
Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:44 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2