Re: new to memory mgmt
Re: new to memory mgmt
- Subject: Re: new to memory mgmt
- From: pmcurry <email@hidden>
- Date: Sun, 15 Feb 2004 14:15:15 -0800
Ah... how the intricate folds of memory management reveal themselves so
slowly!
Somehow, I was under the impression I had to create an
NSAutoreleasePool within any method where I would want to autorelease
an object I created.
Thanks.
-Phil
On Feb 15, 2004, at 1:54 PM, Louis C. Sacha wrote:
Hello...
I thought I had read somewhere that NSAutoreleasePools were expensive
so I've been trying to only use them in a situation where I create an
object within a function that I want to use as the return value. Then
I create a pool in the function and auto release the object just
before returning it. In your example, how can you tell at what point
execution goes back to NSApplicationMain()?
You wouldn't want to _create_ an autorelease pool in this situation.
If you just want to return an autoreleased value, you just send it the
autorelease message, and it automatically uses the current existing
NSAutoreleasePool.
You might want to take a look at:
http://www.stepwise.com/Articles/Technical/MemoryManagement.html (the
sections "Temporary Obejcts" and "Gory Autorelease Details")
and
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/
index.html (there is an article on autorelease pools)
Hope that helps,
Louis
_______________________________________________
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.