File Information
Library: Foundation
Package: Core
Header: Poco/AutoReleasePool.h
Description
An AutoReleasePool implements simple garbage collection for reference-counted objects. It temporarily takes ownership of reference-counted objects that nobody else wants to take ownership of and releases them at a later, appropriate point in time.
Note: The correct way to add an object hold by an AutoPtr<> to an AutoReleasePool is by invoking the AutoPtr's duplicate() method. Example:
AutoReleasePool<C> arp; AutoPtr<C> ptr = new C; ... arp.add(ptr.duplicate());
Member Summary
Constructors
AutoReleasePool
Creates the AutoReleasePool.
Destructor
~AutoReleasePool
~AutoReleasePool();
Destroys the AutoReleasePool and releases all objects it currently holds.
Member Functions
add
void add(
C * pObject
);
Adds the given object to the AutoReleasePool. The object's reference count is not modified
release
void release();
Releases all objects the AutoReleasePool currently holds by calling each object's release() method.