discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What does NSAutoreleasePool actually do?


From: Derek Zhou
Subject: Re: What does NSAutoreleasePool actually do?
Date: Fri, 18 Apr 2003 09:29:41 -0800
User-agent: KMail/1.5.1

You need the NSAutoreleasePool with or without gui because base itself will 
frequently autorelease objects. For command line tools, you can choose to use 
or not to use a runloop; if you use a runloop, it will create & cleanup 
autoreleasepool for you automatically just like in gui. If you don't have any 
runloop and your tool runs a long period of time, it is recommended to create 
and release the pool periodically to avoid leakage.
A good place to start is to read apple's documents:
http://developer.apple.com/techpubs/macosx/Cocoa/CocoaTopics.html
Please read the topic "memory managment" if you want to know more.
Derek

On Friday 18 April 2003 06:51 am, 黃俊傑(Chun-Chieh Huang) wrote:
> Dear all,
>     I have some questions about NSAutoreleasePool in GNUstep.
>
>     I have written some code in OPENSTEP 4.2. I recalled that
> NSAutoreleasePool is cleaned up when the command loop refreshes.
> And I read dread.m and dwrite.m in GNUstep base source tarball.
> The two files, dread.m and dwrite.m, are all command line tools, which
> doesn't need GUI portion. So I think there should be no command loops
> in such a command line tool. But how come there is a NSAutoreleasePool
> instance?
>
>     If it does exist a command loop, what is the loop exactly? And how
> is it operated? If it doesn't exist a command loop, when are objects
> in the pool to be cleaned up?
>
>
>
> P.S.
>     Thanks for those who helped me about making command line tools.
> I use tool.make in my GNUmakefile.
> In my main.m, I created an NSAutoreleasePool, and create my simulator
> instance, set it up, and then make it peform some actions. Finally, I
> release my simulator instance and the pool. I need to modify some
> memory management, but it works. Thanks.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]