我有記憶問題(是)我與一個自定義的UIView下面的方法新的iOS):釋放實例| 「Malloc_history無法檢查進程XYZ,因爲進程不存在。」
頭文件
....
@property (nonatomic, retain) NSString * pressureTextLabel;
....
實現繪製一個圓,一個標籤與關聯至壓力觸摸。每個手指觸摸創建該視圖的對象:
- (void)drawRect:(CGRect)theRect{
CGRect rect = self.bounds;
CGRect ringRect = CGRectInset(rect, 100, 100);
// Outer ring.
UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:ringRect];
ringRect = CGRectInset(rect, 60, 60);
[path appendPath:[UIBezierPath bezierPathWithOvalInRect:ringRect]];
path.usesEvenOddFillRule = YES;
[self.color set];
[path fill];
//text label
rect = CGRectMake(100, 20, 100, 100);
//This one seems to be the troublemaker
[pressureTextLabel drawInRect:rect withFont:[UIFont systemFontOfSize:14.0]];
}
所有隻要這以下的方法不被控制器調用以更新此特定觸摸感測的壓力工作正常。
-(void) setTouchPressureTo: (float) pressure{
pressureTextLabel = [NSString stringWithFormat:@"%f", pressure];
[self setNeedsDisplay];
}
我得到以下錯誤:
*** -[CFString drawInRect:withFont:]: message sent to deallocated instance 0x16e8c0
這讓我探討調試控制檯的記憶痕跡,一旦應用程序崩潰:shell malloc_history <PID> 0x17dfb0
。結果控制檯返回:
malloc_history cannot examine process 5838 because the process does not
存在。
所以這裏的問題是:
- 有人能看到明顯的保留, 釋放問題就在這裏?
- 我怎樣才能獲得
malloc_history <PID> <Address
> 的工作?
謝謝你的時間,重定向和答案!
基督教
如果您在調試器中運行該應用程序,該進程將在發生崩潰後繼續運行,並且您可以在其上運行malloc_history。 – 2011-01-28 01:13:05