libs-base/Documentation/gsdoc/NSAutoreleasePool.gsdoc

120 lines
3.7 KiB
Text
Raw Normal View History

<?xml version="1.0"?>
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 0.6.6//EN" "http://www.gnustep.org/gsdoc-0_6_6.xml">
<gsdoc base="NSAutoreleasePool" prev="NSAttributedString" next="NSBundle" up="Base">
<head>
<title>NSAutoreleasePool</title>
<author name="Richard Frith-Macdonald">
<email address="rfm@gnu.org"/>
<url url="http://www.gnustep.org/developers/whoiswho.html"/>
</author>
<version>$Revision$</version>
<date>$Date$</date>
</head>
<body>
<chapter>
<heading>NSAutoreleasePool</heading>
<class name="NSAutoreleasePool" super="NSObject">
<declared>Foundation/NSAutoreleasePool.h</declared>
<conform>NSObject</conform>
<desc>
<p>
This class maintains a stack of autorelease pools objects
in each thread.
</p>
<p>
When an autorelease pool is created, it is automatically
added to the stack of pools in the thread.
</p>
<p>
When a pool is destroyed, it (and any pool later in
the stack) is removed from the stack.
</p>
</desc>
<method type="void" factory="yes">
<sel>addObject:</sel>
<arg type="id">anObject</arg>
<desc>
<p>
Adds the specified object to the current autorelease pool.
If there is no autorelease pool in the thread,
a warning is logged.
</p>
</desc>
</method>
<method type="void">
<sel>addObject:</sel>
<arg type="id">anObject</arg>
<desc>
<p>
Adds the specified object to this autorelease pool.
</p>
</desc>
</method>
<method type="void" factory="yes">
<sel>enableRelease:</sel>
<arg type="BOOL">flag</arg>
<desc>
<p>
Specifies whether objects contained in autorelease pools are to
be released when the pools are deallocated (by default YES).
</p>
<p>
You can set this to NO for debugging purposes.
</p>
</desc>
<standards><GNUstep/><NotMacOS-X/><NotOpenStep/></standards>
</method>
<method type="unsigned" factory="yes">
<sel>autoreleaseCountForObject:</sel>
<arg type="id">anObject</arg>
<desc>
<p>
Counts the number of times that the specified object occurs
in autorelease pools in the current thread.
</p>
<p>
This method is <em>slow</em> and should probably only be
used for debugging purposes.
</p>
</desc>
<standards><GNUstep/><NotMacOS-X/><NotOpenStep/></standards>
</method>
<method type="void" factory="yes">
<sel>freeCache</sel>
<desc>
<p>
When autorelease pools are deallocated, the memory they used
is retained in a cache for re-use so that new polls can be
created very quickly.
</p>
<p>
This method may be used to empty that cache, ensuring that
the minimum memory is used by the application.
</p>
</desc>
<standards><GNUstep/><NotMacOS-X/><NotOpenStep/></standards>
</method>
<method type="void" factory="yes">
<sel>setPoolCountThreshold:</sel>
<arg type="unsigned">c</arg>
<desc>
<p>
Specifies a limit to the number of objects that may be added to
an autorelease pool. When this limit is reached an exception is
raised.
</p>
<p>
You can set this to a smallish value to catch problems with code
that autoreleases too many objects to operate efficiently.
</p>
<p>
Default value is maxint.
</p>
</desc>
<standards><GNUstep/><NotMacOS-X/><NotOpenStep/></standards>
</method>
</class>
</chapter>
</body>
</gsdoc>