Re: [Pyobjc-dev] Memory leaking
Brought to you by:
ronaldoussoren
From: Bob I. <bo...@re...> - 2006-02-26 20:22:47
|
On Feb 26, 2006, at 1:42 PM, Diez B. Roggisch wrote: >> It's very unlikely to be an actual memory leak. You're not using >> the event loop so the NSAutoreleasePools are not being released. >> You'll need to do that manually, Cocoa uses a lot of autoreleased >> objects internally. >> See this: >> http://pyobjc.sourceforge.net/doc/intro.php#working-with-threads > > I tried that, every 20 renderings - but without the > > del pool > pool = NSAutoreleasePool.alloc().init() > > I just rebound pool. Can you explain why the del is needed? I > thought that would also just decrease the Python-refcount by one, > as the rebinding is supposed to do, too. > > However, thank you very much! NSAutoreleasePool are nested and IIRC the sub-pool retains its parent. Without the del, the previous pool gets collected *after* the new pool is created, which makes it a sub-pool. With the del, the previous pool gets collected *before* the new pool is created, which is the desired behavior. -bob |