Re: new to memory mgmt
Re: new to memory mgmt
- Subject: Re: new to memory mgmt
- From: "Louis C. Sacha" <email@hidden>
- Date: Sun, 15 Feb 2004 13:54:33 -0800
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.