Objective C - 弹出UITableViewController场景时不释放内存

时间:2012-04-15 20:40:15

标签: objective-c ios memory uiviewcontroller automatic-ref-counting

我有一个简单的项目,使用Xcode 4.3.2定位iOS 5.1,使用故事板和NavigationController。我刚刚迁移了项目以使用ARC,我现在注意到当我的UITableViewController场景被弹出(按下后退按钮)时内存没有被回收。当我自己管理记忆时,我确信这工作正常。我正在使用乐器工具的“分配”功能,我可以看到每次推动场景然后弹出时,“实时字节”会继续增加。 UITableViewController的接口是:

#import <UIKit/UIKit.h>
#import "ASIHTTPRequest.h"

@interface StockListView : UITableViewController <UISearchBarDelegate>
{
    NSMutableArray *tableListArray;         
    IBOutlet UISearchBar *searchBarControl;
}

@property (nonatomic) ASIHTTPRequest *httpDSRequest;

@end

UITableView使用如下定义的自定义UITableViewCell类:

#import <UIKit/UIKit.h>

@interface StockListCell : UITableViewCell

@property (nonatomic) IBOutlet UILabel *lblStockCode;
@property (nonatomic) IBOutlet UILabel *lblDescription;
@property (nonatomic) IBOutlet UILabel *lblQtyInStock;
@property (nonatomic) IBOutlet UILabel *lblQtyFree;

@end

我正在使用的属性中是否存在保持视图控制器保留在内存中的内容?我是否需要添加一些代码以允许视图控制器在我使用ARC时完全解除分配?

我还使用了仪器的“泄漏”功能,但这并未显示任何泄漏。

任何帮助表示赞赏,道歉我仍然是iOS开发的新手。

由于 乔纳森

1 个答案:

答案 0 :(得分:1)

你应该使按钮弱引用

@property (weak, nonatomic) IBOutlet UILabel *lblStockCode;

也许看看这个:ARC Transition