一个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;
}

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
ios5.1运行时的bug。。。
你的理解没错的,是sdk的bug,ScrollView是内存泄露的元凶。