Loading [MathJax]/extensions/tex2jax.js
Cocos2d-x  v4
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Modules Pages
AutoreleasePool Class Reference

A pool for managing autorelease objects. More...

Public Member Functions

 AutoreleasePool ()
 
 AutoreleasePool (const std::string &name)
 Create an autorelease pool with specific name. More...
 
 ~AutoreleasePool ()
 @js NA @lua NA
 
void addObject (Ref *object)
 Add a given object to this autorelease pool. More...
 
void clear ()
 Clear the autorelease pool. More...
 
bool contains (Ref *object) const
 Checks whether the autorelease pool contains the specified object. More...
 
void dump ()
 Dump the objects that are put into the autorelease pool. More...
 

Detailed Description

A pool for managing autorelease objects.

@js NA

Constructor & Destructor Documentation

◆ AutoreleasePool() [1/2]

Warning
Don't create an autorelease pool in heap, create it in stack. @js NA @lua NA

◆ AutoreleasePool() [2/2]

AutoreleasePool ( const std::string &  name)

Create an autorelease pool with specific name.

This name is useful for debugging.

Warning
Don't create an autorelease pool in heap, create it in stack. @js NA @lua NA
Parameters
nameThe name of created autorelease pool.

Member Function Documentation

◆ addObject()

void addObject ( Ref object)

Add a given object to this autorelease pool.

The same object may be added several times to an autorelease pool. When the pool is destructed, the object's Ref::release() method will be called the same times as it was added.

Parameters
objectThe object to be added into the autorelease pool. @js NA @lua NA

◆ clear()

void clear ( )

Clear the autorelease pool.

It will invoke each element's release() function.

@js NA @lua NA

◆ contains()

bool contains ( Ref object) const

Checks whether the autorelease pool contains the specified object.

Parameters
objectThe object to be checked.
Returns
True if the autorelease pool contains the object, false if not @js NA @lua NA

◆ dump()

void dump ( )

Dump the objects that are put into the autorelease pool.

It is used for debugging.

The result will look like: Object pointer address object id reference count

@js NA @lua NA


The documentation for this class was generated from the following file: