我试图理解为什么仪器会说以下代码中的指示行导致脏内存增长。返回基线状态后,我在第二次堆射击(基线之后)中得到了这个。谁能指出我的错误?
CCSprite *baseSprite = NULL;
CCSprite *mainHandSprite = NULL;
CCSprite *offHandSprite = NULL;
CCSprite *helmetSprite = NULL;
CCSprite *torsoSprite = NULL;
CCSprite *gloveSprite = NULL;
CCSprite *bootSprite = NULL;
NSString* afile = [NSString stringWithFormat:@"%@%i.PNG", file, num];
baseSprite = [[CCSprite alloc]initWithFile:afile]; /* HEAP GROWTH */
baseSprite.anchorPoint = ccp(0,0);
int w = baseSprite.textureRect.size.width;
int h = baseSprite.textureRect.size.height;
mainHandSprite = [self mainHandSprite:file And:num];
helmetSprite = [self headSprite:file And:num];
torsoSprite = [self torsoSprite:file And:num];
offHandSprite = [self shieldSprite:file And:num];
gloveSprite = [self gloveSprite:file And:num];
bootSprite = [self bootSprite:file And:num];
CCRenderTexture *rt = [CCRenderTexture renderTextureWithWidth:w height:h]; /*HEAP GROWTH */
[rt begin];
[baseSprite visit];
if (torsoSprite)
[torsoSprite visit];
if (helmetSprite)
[helmetSprite visit];
if (offHandSprite)
[offHandSprite visit];
if (bootSprite)
[bootSprite visit];
if (gloveSprite)
[gloveSprite visit];
if (mainHandSprite)
[mainHandSprite visit];
[rt end];
CCTexture2D *aTex = rt.sprite.texture;
[aTex setAntiAliasTexParameters];
[baseSprite release];
baseSprite = NULL;
[mainHandSprite release];
mainHandSprite = NULL;
[torsoSprite release];
torsoSprite = NULL;
[helmetSprite release];
helmetSprite = NULL;
[offHandSprite release];
offHandSprite = NULL;
[gloveSprite release];
gloveSprite = NULL;
[bootSprite release];
bootSprite = NULL;
return aTex;