On Friday, February 22, 2002, at 06:34 PM, Nicola Pero wrote:

>
>> 1.
>> In [NSApplication -terminate:] the application tries to dealloc itself,
>> but it's still being retained by the
>> NSApplicationWillTerminateNotification. I talked about it with
>> Pierre-Yves (IRC) and he suggested that exit() should be called in
>> NSApplicationMain() instead of in terminate:. I moved the 
>> DESTROY(NSApp)
>> and exit() to NSApplicationMain() (sortof), and it seemed to work (and
>> it took care of ~1000 unreleased objects).
>
> Hmmm ... I added an autorelease pool to NSApplication.m -terminate:, 
> which
> at least causes the NSApp to dealloc.
>
> But I suppose this won't dealloc all the objects it should ... the 
> actual
> complete fix might be to store the current application runloop 
> autorelease
> pool (the one setup inside -run) into an ivar, so that -terminate: can
> destroy that autorelease pool.
>
> Anyone with comments against that change ?

Sounds good - could also do a sanity check to make sure that the -run 
method
is not called recursively.

> #
>
> In general all this work of destroying all objects ordinately by hand, 
> one
> by one, on shutdown will actually cause the shutdown to be slower -
> calling exit(0) without deallocating anything and just returning all the
> process memory to the environment immediately is much faster.
>
> But of course the point is that you might have created an object which 
> is
> taking up some files/network resources/distributed locks, and you 
> releases
> these resources in the -dealloc method of the object.  We need then to
> dealloc all objects ordinately so that the -dealloc of your object is
> actually called and the resources are actually freed.

Yes ... I think we should really clean up properly.


_______________________________________________
Bug-gnustep mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to