[Top][All Lists]

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

Re: Segfault in -[NSObject dealloc]

From: Markus Hitter
Subject: Re: Segfault in -[NSObject dealloc]
Date: Thu, 18 May 2006 09:51:50 +0200

Am 18.05.2006 um 07:18 schrieb Richard Frith-Macdonald:

On 18 May 2006, at 05:31, Michael Gardner wrote:

I'm allocating objects with class_createInstance(), storing them on a stack (well, just a plain NSArray), and popping them off at a later time. When I pop an object from the stack, it gets released (as I expect), but I get a segfault from -[NSObject dealloc] that I can't track down.

I'm pretty sure I'm not double-releasing the object since I've sprinkled printf statements in my dealloc methods, and I've tried looking through NSObject.m to find the culprit, but can't see where the segfault is coming from (the inline functions hinder debugging somewhat). What kind of things can cause segfaults in - [NSObject dealloc]? Could this be a GNUstep bug?

You can't use class_createInstance() to create instances of GNUstep classes (unless you build NSObject.m in the base library specially to permit it). The way to allocate OpenStep/GNUstep objects is using the NSAllocateObject() function.

Can I add "+[myClass alloc] would be even better"?

I'm really wondering what's the big difference between GNUsteppers and Cocoa developers. According to the mailing lists, GNUsteppers are regularly using low level functions (objc_...()), +load and thisalike. On Cocoa lists, I've yet to read a single line about this stuff; they obviously use NSObject and above and are happy with this.

Is GNUstep missing some important piece of the Obj-C cake or are GNUsteppers simply more comfortable with the C language?


- - - - - - - - - - - - - - - - - - -
Dipl. Ing. Markus Hitter

reply via email to

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