OCAutoreleasePool

group OCAutoreleasePool

Implements an autorelease pool for OCTypes.

Functions

OCAutoreleasePoolRef OCAutoreleasePoolCreate(void)

Creates a new autorelease pool. The caller must release it when done.

Returns:

A reference to the newly created autorelease pool.

bool OCAutoreleasePoolRelease(OCAutoreleasePoolRef pool)

Releases an autorelease pool and all objects it contains.

Parameters:
  • pool – The autorelease pool to release. Must not be NULL. Releasing a non-topmost pool also drains nested pools.

Returns:

true if the pool was successfully released, false otherwise.

const void *OCAutorelease(const void *ptr)

Adds an object to the current (topmost) autorelease pool.

Parameters:
  • ptr – Pointer to the OCType object to autorelease. Must be non-NULL.

Returns:

The same pointer passed in, allowing for chained calls.

void OCAutoreleasePoolDrain(OCAutoreleasePoolRef pool)

Drains an autorelease pool, releasing all objects it contains without deallocating the pool itself.

Parameters:
  • pool – The autorelease pool to drain. Must not be NULL.

void OCAutoreleasePoolCleanup(void)