Re: Main window disappears. Sometimes.
Re: Main window disappears. Sometimes.
- Subject: Re: Main window disappears. Sometimes.
- From: Francis Perea <email@hidden>
- Date: Mon, 2 Jun 2008 13:16:19 +0200
Hi Paul.
I've disabled GC as Michael and you propose and the application it's
working right now.
I've had to "retain" both properties of the model class (generator)
and the instance of that class in the controller class
(generatorcontroller).
I've also had to implement both dealloc method of both classes so that
all retained objects get released.
Is that right?
And a final question, I would like to know if my application frees up
all memory it uses after stopping and it has no memory leaks; I think
Instruments is the utility Apple provides for that matter, isn't it?
In that case I should read Instruments help so that I know how to get
that information, cos I've tried to use it but it doesn't seem very
friendly to me :-(
Thanks all a lot for your explanations and your time, it's getting me
clear.
Att.
Francis Perea
El 02/06/2008, a las 11:50, Paul Sargent escribió:
As Michael says, retain and release become null-operations when
garbage collection is switched on (so code can be written to run as
both GC and non-GC).
If nothing is holding onto a pointer to your window then it'll be
collected by the garbage collector. Something has to hold on to a
pointer to it.
I believe it's worth writing an application or two without using
garbage collection if you're starting out. GC is one area in Cocoa
that's a bit like magic if you don't understand how it works.
Learning everything else with 'magic stuff' happening can be
difficult. Retain and Release are pretty simple, and as long as you
stay within Objective C (i.e. don't start using the CoreFoundation C
API) managing it all is pretty straight forward.
Once you're comfortable with that, switch GC back on and get used to
how it works.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden