cocos2d/cocos2d-x — pull request #2481 by sergey-shambir (2013-04-27 11:42:37+00:00)
Title: Adds weak reference support

Most memory leaks are caused by circular references. CCWeakReference is created to solve this problem.

## Usage:

```
CCObject *obj = new CCObject()
CCWeakReference ref1 = CCWeakRefenrece(obj);
CCWeakReference ref2;
ref2 = ref1;
ref2.getObject(); // obj
CC_SAFE_RELEASE_NULL(obj);
ref2.getObject(); // NULL
```

## Efficiency:

The only overhead is `releaseWeakReferenceFor(this);` called in `CCObject::~CCObject()`. But the time it takes is really negligible. It runs at O(lgN) time, in which N is the amount of CCObjects been weakly referenced.