Skip navigation.
 
mlRe: Main window disappears. Sometimes.
FROM : Paul Sargent
DATE : Mon Jun 02 20:55:31 2008

On 2 Jun 2008, at 12:16, Francis Perea wrote:

> 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).


There's a few simple rules that specify when you have to retain 
something, and when you don't. The document Graham gave you goes 
through them.

I don't want to repeat them here because I'd probably get it slightly 
wrong and people love to argue over the fine detail. We found that out 
in another thread recently.

> I've also had to implement both dealloc method of both classes so 
> that all retained objects get released.
>
> Is that right?


Yes, that's exactly the reason for dealloc.

> 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?


An application will automatically free everything when it quits.

If you want a way of seeing if you've released everything you 
allocated, then it's worth looking back in the archive a couple of 
weeks, as there was a thread talking about how to do it. I think the 
conclusion was "put a sleep statement before the app quits". That way 
you have some time to see the final state.

> 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 :-(


Instruments is one tool that can do it. Also there's the 'leaks' 
command line tool, and ObjectAlloc (which appears to be an Instruments 
template now).

Don't worry too much about getting rid of all memory leaks while 
you're learning. There's lot's of stuff to learn, and as you get more 
experience you'll start to see the patterns. If you get problems with 
over releasing something (which will often cause you to crash), search 
for NSZombiesEnabled in the docs.

Have fun.

Related mailsAuthorDate
mlMain window disappears. Sometimes. Francis Perea Jun 2, 09:58
mlRe: Main window disappears. Sometimes. Wayne Packard Jun 2, 10:06
mlRe: Main window disappears. Sometimes. Francis Perea Jun 2, 10:36
mlRe: Main window disappears. Sometimes. Michael Vannorsdel Jun 2, 10:45
mlRe: Main window disappears. Sometimes. Francis Perea Jun 2, 11:05
mlRe: Main window disappears. Sometimes. Michael Vannorsdel Jun 2, 11:19
mlRe: Main window disappears. Sometimes. Paul Sargent Jun 2, 11:50
mlRe: Main window disappears. Sometimes. Graham Cox Jun 2, 13:11
mlRe: Main window disappears. Sometimes. Francis Perea Jun 2, 13:16
mlRe: Main window disappears. Sometimes. Francis Perea Jun 2, 13:24
mlRe: Main window disappears. Sometimes. Michael Vannorsdel Jun 2, 19:31
mlRe: Main window disappears. Sometimes. Bill Bumgarner Jun 2, 19:50
mlRe: Main window disappears. Sometimes. Paul Sargent Jun 2, 20:35
mlRe: Main window disappears. Sometimes. mmalc crawford Jun 2, 20:40
mlRe: Main window disappears. Sometimes. Paul Sargent Jun 2, 20:55
mlRe: Main window disappears. Sometimes. Francis Perea Jun 2, 22:48
mlRe: Main window disappears. Sometimes. Bill Bumgarner Jun 2, 22:50
mlRe: Main window disappears. Sometimes. Henry McGilton (St… Jun 3, 04:19
mlRe: Main window disappears. Sometimes. William Bumgarner Jun 3, 04:47
mlRe: Main window disappears. Sometimes. Michael Ash Jun 3, 06:50
mlRe: Main window disappears. Sometimes. Sean McBride Jun 3, 17:28
mlRe: Main window disappears. Sometimes. Stephane Sudre Jun 3, 18:20
mlRe: Main window disappears. Sometimes. Bill Bumgarner Jun 3, 18:29
mlRe: Main window disappears. Sometimes. Stephane Sudre Jun 3, 18:56
mlRe: Main window disappears. Sometimes. Andy Lee Jun 3, 19:02
mlRe: Main window disappears. Sometimes. Hamish Allan Jun 3, 19:22
mlRe: Main window disappears. Sometimes. Bill Bumgarner Jun 3, 19:25