I just create a simple UITableView in the UIViewController.
.h
#import <UIKit/UIKit.h>
@interface RootController : UIViewController <UITableViewDataSource>
{
NSMutableArray *_tableData;
UITableView *_tableView;
}
@end
.m
#import "RootController.h"
@implementation RootController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
if (!_tableData) {
_tableData = [[NSMutableArray alloc] initWithCapacity:20];
for (int i = 0; i < 50; i++) {
[_tableData addObject:[NSString stringWithFormat:@"%d", i]];
}
}
}
return self;
}
- (void)dealloc
{
[_tableView release];
[_tableData release];
[super dealloc];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)loadView
{
UIView *view = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.view = view;
[view release];
self.view.backgroundColor = [UIColor whiteColor];
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
_tableView.dataSource = self;
}
[self.view addSubview:_tableView];
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [_tableData count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"TableViewCellIdentifier";
UITableViewCell *cell = nil;
cell = [_tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease];
}
cell.textLabel.text = [_tableData objectAtIndex:indexPath.row];
return cell;
}
@end
I used instruments to detect memory leak for this, when I scrolled the UITableView, memory
leak occurred.

I use Xcode 4.3.1 and iOS5.1 (iPod touch4).
Someone had this problem?
If you look at the ‘responsible library’ column, you can see that the culprit is not your code. The leaks are small, you can safely ignore them.
Here is a similar question: WebView: libdispatch leaks in an ARC-enabled app