Memory increasing over time.Please help

Hi, everyone!
I have a major problem with the memory increasing over time.
When I remove the CCSprite from the CCSpriteBatchNode, the memory doesn’t decrease(see form the task manager).
Over time, about 2 hours, my game will be run out of memory.
I did many tests and found that if I didn’t use CCSpriteBatchNode, frame rates should be very low but the memory would not increase so many.

Sorry for so poor English.

Can you give some example code where you create your sprites?

Adam Reed wrote:

Can you give some example code where you create your sprites?

THX.

@
bool HelloWorldScene::init()
{
m_pBatch = CCSpriteBatchNode::create(“somefile.png”);
this~~>addChild;
CCLabelTTF lable1 = CCLabelTTF::create;
CCMenuItemLabel
item1 = CCMenuItemLabel::create&HelloWorldScene::addTest);
CCLabelTTF lable2 = CCLabelTTF::create;
CCMenuItemLabel
item2 = CCMenuItemLabel::create&HelloWorldScene::removeTest);
CCMenu menu = CCMenu::create;
this~~>addChild;
menu~~>setPosition);
item1~~>setPosition);
item2~~>setPosition);
return true;
}
std::vector<CCSprite *> spriteVector;
void HelloWorldScene::addTest
{
for
{
CCSprite
test = CCSprite::createWithTexture);
test~~>setPosition(ccp(500, 500));
m_pBatch~~>addChild;
spriteVector.push_back;
}
}
void HelloWorldScene::removeTest
{
if )
{
return;
}
for
{
CCSprite *test = spriteVector.back;
test~~>removeAllChildrenWithCleanup(true);
m_pBatch->removeChild(test, true);
spriteVector.pop_back();
}
}
@

I found CCTextureAtlas::initWithTexture may cause the problem
How do I solve this problem?

Your code example does not include that code.
Where are you calling CCTextureAtlas::initWithTexture and where are you releasing it?

I didn’t call CCTextureAtlas::initWithTexture obviously in my code.
It is called in CCSpriteBatchNode::initWithTexture, which is called by CCSpriteBatchNode::create.
And release is called in the destructor of CCSpriteBatchNode.

I did an other similar test with the code below, and found the memory would also increase.

`void HelloWorldScene::addTest(CCObject *) {
for (int i = 0; i < 100; ++i) {
CCTextureAtlas *tex = new CCTextureAtlas();

// if I didn’t call CCSpriteBatchNode::initWithTexture here,
// the memory would not increace certainly.
tex->initWithTexture(someTexture, 29);

tex->release();
}
}`

Adam Reed wrote:

Your code example does not include that code.
Where are you calling CCTextureAtlas::initWithTexture and where are you releasing it?

If I modified the code in the file ccConfig.h #define CC_USES_VBO 1 to #define CC_USES_VBO 0, whitch meant I didn’t use VBO, the memory would not increace any more.
It seems to have solved my problem, but I don’t know what the consequences are.