views:

433

answers:

1

Hello all,

I found that memory kept growing without any memory allocated in code when running a opengles based program on iPhone 3G device.

Copy from Instrument:

    Instances / Responsible / Responsible Caller
    ------------------------------------------------------------
    GeneralBlock-8 / QuartzCore / x_list_prepend_
    GeneralBlock-56 / QuartzCore / CAImageQueueCollect

Here's the link about the same problem, link.

Is there any way to fix it or just leave it alone?

Thank you.

+2  A: 

I was facing the same issue but then I realized that the tool doesn't show any leaks though there are some leaks.

Like in the following case:

@property(nonatomic,retain) NSMutableArray *arr;
self.arr = [[NSMutableArray alloc] init];

In dealloc:

[self.arr release];

This is a leak which is not predicted by tools.

When the array is created it comes with retain count of 1 and when you use setter method using self it increases it to two. But you are just releasing it once.

So the right way of doing it is:

NSMutableArray *tempArr = [[NSMutableArray alloc] init];
self.arr = tempArr;
[tempArr release];

In dealloc:

[self.arr release];

See if this issue can resolve your problem.

rkb
or:NSMutableArray *tempArr = [[[NSMutableArray alloc] init]autorelease];self.arr = tempArr;
Felixyz