Re: massive amounts of offscreen windows
Re: massive amounts of offscreen windows
- Subject: Re: massive amounts of offscreen windows
- From: Ev <email@hidden>
- Date: Fri, 22 Aug 2003 10:20:02 -0500
On Friday, August 22, 2003, at 09:57 AM, Yann Bizeul wrote:
It looks like a problem I had with GeekTool. There is a point I
understand in your description is that you do not require user actions
to make things, that was the same problem for me, and it seem that if
you do not have user actions, autorelease pools are not always
correctly de-allocated.
The solution for me was to set an autorelease pool in some critical
methods like this :
NSAutoreleasePool *pool = [[ NSAutoreleasePool alloc ] init ];
[ do things ]
[ pool release ];
Let me know what you think/test/sucess :-)
Well, I tried some quick tests to no avail. Same numbers. I surrounded
the drawing calls and the drawRect: calls, which is really where the
stuff is generated.
As I understand it, though, an AutoreleasePool is always existing in
the main thread. None of these drawing calls are outside the main
thread, so it uses the main autorelease pool anyway, as far as I know.
They're all inside the standard drawRect: calls. Autorelease pools are
used for other outside threads (which I do use elsewhere in the app),
and they seem to work fine.
In actuality, the graphics *are* created by user actions - scrolling,
especially. That seems to be the main culprit for generating all these
offscreen windows. By the time I go a simple zoom in and scroll around
a little, by the time the app closes there's 81 windows! There's no
graphics created by a timer or polling or some such thing, if that's
what you mean.
---
I have a NSLog(@"window count = %d", [[NSApp windows] count]) call at
the close of my app, so I'm getting more solid numbers now (without
having to debug), and it seems even with simple scrolling and such, I'm
closing the app with no less than 15 windows, sometimes up to 100+. Is
this what caching is?
-ev
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.