With each call to setString the memory usage of my program rises, which eventually leads to the program crashing due to lack of memory.
The code of the scene I was testing this behavior is:
bool TestScene::init()
{
@ bool bRet = false;@
@ do @
@ {@
@ CC_BREAK_IF(! CCLayer::init());@
@ mTestLabel = CCLabelTTF::labelWithString(“Test String”, “Arial”, 24);@
@ mTestLabel~~>setPosition);@
@ mTestLabel~~>retain();@
@ schedule(schedule_selector(TestScene::update));@
@ bRet = true;@
@ } while (0);@
@ return bRet;@
}
void TestScene::draw()
{
@ CCLayer::draw();@
@ mTestLabel~~>draw;@
}
void TestScene::update(ccTime dt)
{
@ mTestLabel~~>setString(“Test String”);@
}
the version of cocos i’m running is cocos2d-1.0.1-x-0.12.0