Projects > cpp > Issues > Bug #484

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

CCTextureAtlas::initWithTexture() may cause memory leak

Bug #484 [Closed]
zhangxm 2011-05-06 01:03 . Updated about 10 years ago

bool CCTextureAtlas::initWithTexture(CCTexture2D texture, unsigned int capacity)
{
assert;
m_uCapacity = capacity;
m_uTotalQuads = 0;
// retained in property
this->m_pTexture = texture;
CC_SAFE_RETAIN;
m_pQuads = calloc
m_uCapacity, 1 );
m_pIndices = (GLushort )calloc m_uCapacity * 6, 1 );

if( ! ( m_pQuads && m_pIndices) ) {
//CCLOG(“cocos2d: CCTextureAtlas: not enough memory”);
CC_SAFE_FREE(m_pQuads)
CC_SAFE_FREE(m_pIndices)
return false;
}

When the condition in if sentence is true, should release the texture. Because the destructure will release it, so should use CC_SAFE_RELEASE_NULL() to release it.

walzer@cocos2d-x.org 2011-05-08 03:00
  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Applied in changeset commit:7cd52b11452e99982379a142dd9dad771b9b7922.

zhangxm 2011-05-08 03:00

Applied in changeset commit:e93c06bb70038cb577e340b6ee1aab95cb576f48.

walzer@cocos2d-x.org 2011-05-08 05:53
  • Status changed from Resolved to Closed
walzer@cocos2d-x.org 2012-05-25 08:11
  • Project changed from cocos2d-x to cpp
  • Category deleted (5)
  • Target version deleted (cocos2d-0.99.5-x-0.8.3)
agenindonesia 2014-11-25 20:41

Pokerstar88.com Agen Texas Poker Dan Domino Online Indonesia Terpercaya
OK, I’ve updated the announcement and added a link to zipball on google code. Thank you for reminding me.
Agen Indonesia | Agen Bola | Poker Indonesia

agenindonesia 2014-11-25 20:42

Pokerstar88.com Agen Texas Poker Dan Domino Online Indonesia Terpercaya
OK, I’ve updated the announcement and added a link to zipball on google code. Thank you for reminding me.
Agen Indonesia | Agen Bola | Poker Indonesia

ionliga 2014-11-28 14:48

The optimization introduces a bug where the priority and Touch Mode will not get changed if the list is locked.
The most straight forward fix is to merge the pHandlersToAdd and pHandlersToRemove into a queue and process through all of them in the order they are received

Pokerstar88.com Agen Texas Poker dan Domino Online Indonesia Terpercaya | Agen Bola | Taruhan Bola | Agen Bola | Olb365.com Agen Judi Bola Online, Agen Judi Casino Online Indonesia Terpercaya | Jasa SEO | Agen Sbobet

Atom PDF

Status:Closed
Start date:2011-05-06
Priority:Normal
Due date:
Assignee:zhangxm
% Done:

100%

Category:-
Target version:-