UITableView快速滚动时报内存泄露

一个UITableViewStyleGrouped的UITableView,在快速上下拖动时会报内存泄露
48Bytes libsystem_c.dylib strdup
google了下,疑似sdk的bug
问:谁能给解释下这是咋回事儿

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    UITableView *table = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 460) style:UITableViewStyleGrouped];

    table.delegate = self;
    table.dataSource = self;
    [self.view addSubview:table];
    [table release];
  
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 10;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 10;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *ProductDetailCellIdentifier = @"product_detail_cell";
	UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:ProductDetailCellIdentifier];
	if (nil == cell) {
		cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ProductDetailCellIdentifier] autorelease];
        
	}
    return cell;

}

请输入图片描述

阅读 7.6k
2 个回答

ios5.1运行时的bug。。。

你的理解没错的,是sdk的bug,ScrollView是内存泄露的元凶。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题