当我滚动表格视图时,我在乐器上发现了这个泄漏 我做的滚动越多,我得到的泄漏就越多,而且我的应用程序中的每个表视图都会发生这种情况。
有人可以告诉我这里我做错了吗?
0 libsystem_c.dylib malloc
1 libsystem_c.dylib strdup
2 libnotify.dylib token_table_add
3 libnotify.dylib notify_register_mach_port
4 libnotify.dylib notify_register_dispatch
5 CoreFoundation _CFXNotificationRegisterObserver
6 CoreFoundation CFNotificationCenterAddObserver
7 UIKit -[UIScrollView(Static) _startTimer:]
8 UIKit -[UIScrollView _endPanWithEvent:]
9 UIKit -[UIScrollView handlePan:]
10 UIKit _UIGestureRecognizerSendActions
11 UIKit -[UIGestureRecognizer _updateGestureWithEvent:]
12 UIKit ___UIGestureRecognizerUpdate_block_invoke_0541
13 UIKit _UIGestureRecognizerApplyBlocksToArray
14 UIKit _UIGestureRecognizerUpdate
15 UIKit _UIGestureRecognizerUpdateGesturesFromSendEvent
16 UIKit -[UIWindow _sendGesturesForEvent:]
17 UIKit -[UIWindow sendEvent:]
18 UIKit -[UIApplication sendEvent:]
19 UIKit _UIApplicationHandleEvent
20 GraphicsServices PurpleEventCallback
21 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
22 CoreFoundation __CFRunLoopDoSource1
23 CoreFoundation __CFRunLoopRun
24 CoreFoundation CFRunLoopRunSpecific
25 CoreFoundation CFRunLoopRunInMode
26 GraphicsServices GSEventRunModal
27 UIKit UIApplicationMain
28 MyApp 0x2bda
29 MyApp 0x2b6f
这是表视图viewController .m文件:
@implementation ContactsViewController
@synthesize data = _data;
@synthesize tableView = _tableView;
- (void)dealloc
{
[_data release];
[_tableView release];
[super dealloc];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bg411.png"]];
self.title = @"Contacts";
// init tableView
CGRect tableFrame = self.view.bounds;
_tableView = [[UITableView alloc] initWithFrame:tableFrame style:UITableViewStylePlain];
_tableView.backgroundColor = [UIColor clearColor];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.view addSubview:_tableView];
// load data
self.data = [self loadData];
}
- (NSArray *)loadData
{
NSArray *data = [NSArray arrayWithObjects:@"1", @"2", @"3", nil];
return data;
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
self.tableView = nil;
}
#pragma mark - UITableViewDataSource
- (NSInteger)numberOfRowsInOnlySection
{
return self.data.count;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [self numberOfRowsInOnlySection];
}
- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath
{
NSString *currData = [self.data objectAtIndex:indexPath.row];
cell.textLabel.text = currData;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"SingleCell";
UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
[self configureCell:cell atIndexPath:indexPath];
return cell;
}
@end
答案 0 :(得分:1)
我打赌它会发生在您的UIScrollViewDelegate
个方法上,可能是scrollViewDidEndDragging:willDecelerate
。
尝试运行Analyze来自己解决大多数明显的问题。
现在这是已知的SDK错误,请参阅dev's forum