gnu3dkit-discuss
[Top][All Lists]
Advanced

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

Re: [Gnu3dkit-discuss] G3DLine -initWithOrigin:Endpoint:


From: Philippe C . D . Robert
Subject: Re: [Gnu3dkit-discuss] G3DLine -initWithOrigin:Endpoint:
Date: Mon, 21 Oct 2002 22:31:09 +0200

On Monday, October 21, 2002, at 07:48  Uhr, Brent Gulanowski wrote:

This code could possibly leak:

  vector = [[G3DVector3f alloc] initWithElements:tmp];

  line = [self initWithOrigin:s direction:vector factor:f];

  [vector release];

If an exception is raised in -initWithOrigin:direction:factor: (say, during a -copy). On OS X, the recommended solution is to autorelease the object as soon as it is instantiated. I understand that GNUstep is unable to provide autorelease pools due to an Apple patent. In which case, do you prefer to risk the leak, or to special case the code for OS X and GNUstep?

GNUstep offers autorelease pools just as Cocoa or any other OpenStep based API. Exceptions should not be raised in such a situation, so this is not a real problem.

BTW excessive use of autorelease pools is not recommended in any case, ie. not in 'realtime (rendering)' applications!

More generally, what is the preferred strategy for differentiating code for OS X and GNUstep? Do we prefer to never special case unless forced to? Are we treating GNUstep as our primary target?

There is no differentiation needed. Thus there is no such thing as primary target, unless of course something is not available in one API (as ie. the NSOpenGL* classes which are not yet there in GNUstep).

-Phil
--
Philippe C.D. Robert
http://www.nice.ch/~phip





reply via email to

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