discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: strange crasher that puzzles me


From: Sebastian Reitenbach
Subject: Re: strange crasher that puzzles me
Date: Tue, 31 Mar 2009 17:12:56 +0200
User-agent: KMail/1.9.9

Hi,

On Tuesday 31 March 2009 04:19:24 pm David Chisnall wrote:
> On 31 Mar 2009, at 14:32, Sebastian Reitenbach wrote:
> >    numberStack = [NSMutableArray array];
>
> This line is your problem.  It creates an autoreleased array.  The
> next time you enter this method, the numberStack pointer will still be
> non-nil, but if the autorelease pool has been destroyed (typically at
> the end of the run loop iteration) then this pointer will be invalid.
> Attempting to dereference it will cause a segmentation fault.  Try
> changing it to:
>
>     numberStack = [NSMutableArray new];
>
that worked well, thanks a lot. Obviously, memory management in objective-c is 
one of the parts that I do not yet understand. I should read up that topic 
again ;)
Are there any easy rules of thumb to follow, any good documentation about 
memory-management in objective-c for the "beginner" like me?
So if anyone remembers a document that made him think after reading: "ah, 
thats the way how it works" then you could make me happy pointing me to such 
a document ;)

IIRC, I read that "Hold Me, Use Me, Free Me", which is nice, but that did not 
helped me much in uderstanding everything completely.

again, thanks
Sebastian

> David






reply via email to

[Prev in Thread] Current Thread [Next in Thread]