2012-01-06 9 views
0

これはpaint appであり、プロファイル/ゾンビの測定器を使用しています。どうやらあなたが描くときに記憶は上昇し続けているようです。私のペイントがメモリをリークしますか?

私はそれが漏れている場所を見つけたと思うが、本当に間違っているのは分からない。

誰かアイデア?ここに問題のコードがあります:

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { 
    mouseSwiped = YES; 

    UITouch *touch = [touches anyObject]; 
    CGPoint currentPoint = [touch locationInView:self.view]; 
    currentPoint.y -= 0; 


    UIGraphicsBeginImageContext(self.view.frame.size); 
    [drawImage.image drawInRect:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; 
    CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound); 
    CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 10.0); 
    CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 0.0, 0.0, 0.0, 1.0); 
    CGContextBeginPath(UIGraphicsGetCurrentContext()); 
    CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y); 
    CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y); 
    CGContextStrokePath(UIGraphicsGetCurrentContext()); 
    drawImage.image = UIGraphicsGetImageFromCurrentImageContext(); 
    UIGraphicsEndImageContext(); 

    lastPoint = currentPoint; 

} 

答えて

2

おそらく、漏れを検出するためにプロファイルリーク計測器を使用する必要があります。ゾンビ器具は、割り当て解除されたオブジェクトにNSZombieオブジェクトを配置することによって動作します。そのため、割り当てられたオブジェクトの数が連続的に増加するのがわかります。

+0

つまり、オブジェクトが決して割り当て解除されないため、メモリプロファイリングを実行するときはNSZombiesを有効にしないでください。 –

関連する問題