Article View: comp.sys.next.programmer
Article #1535Freeing Objects
From: John Alegre
Date: Thu, 15 Oct 1992 18:56
Date: Thu, 15 Oct 1992 18:56
60 lines
2498 bytes
2498 bytes
This should spark some discussion.
I have an app with four subprojects. I have a main "Controller Object"
which communicates with the File Owner of all the subprojects. Menus and
Buttons, etc are connected to the Controller Object which then sends
messages to the File Owner objects of the subprojects to init themselves,
load .nib files, and respond to various other methods when needed.
Ok, fine.
In my Controller Object, I have the method:
-free:sender;
{
(Code to clean up Controller Object instance vars)
[mySubprojectOwnerObject1 free];
[mySubprojectOwnerObject2 free];
[mySubprojectOwnerObject3 free];
[mySubprojectOwnerObject4 free];
return self;
}
and each of my SubprojectOwnerObjects has a method:
-free:sender;
{
(Code to clean up File Owner Object instance vars)
return [super free];
}
I do this because my subprojects are created and destroyed many
times during the course of the application and I do not want to
grab more memory than I need.
Well yesterday in gdb I noticed that none of my -free methods
are ever being called. The program exits normally without ever
calling these methods as far as I can tell.
Do such File Owner and Controller objects not need to be freed?
Am I not connecting something or setting up a delegate correctly?
(The File Owner objects sets the proper View as it's delegate.)
If it is a case of not needing to free such objects, what objects
should be freed and what ones not?
Replies received that are not posted in comp.sys.next.programmer
will be summarized.
Thank you
John N. Alegre
Andante Systems
VideoLabs Inc.
#############################################################
# NeXTMail preferred. |
# jdev@andnate.mn.org |
# alegrej@andante.mn.org | If you plant ice,
# jdev@lenti.andante.mn.org | you're gonna harvest wind!
# alegrej@libros.andante.mn.org | Hunter/Garcia
#############################################################
Technical Details
Message-ID:
<1992Oct15.185600.24457@news2.cis.umn.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!ogicse!uwm.edu!zazen!doug.cae.wisc.edu!umn.edu!tsp.med.umn.edu!jalegreShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!uwm.edu!zazen!doug.cae.wisc.edu!umn.edu!tsp.med.umn.edu!jalegre From: jalegre@tsp.med.umn.edu (John Alegre) Newsgroups: comp.sys.next.programmer Subject: Freeing Objects Message-ID: <1992Oct15.185600.24457@news2.cis.umn.edu> Date: 15 Oct 92 18:56:00 GMT Article-I.D.: news2.1992Oct15.185600.24457 Sender: news@news2.cis.umn.edu (Usenet News Administration) Organization: University of Minnesota Lines: 60 Nntp-Posting-Host: tsp.med.umn.edu