ARC内存管理:随机内存警告

时间:2013-05-31 13:00:00

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

我一直在随机崩溃说:

收到内存警告。 (lldb)

现在经过一些阅读后我发现这可能是由于内存管理,资源被充分利用而且没有任何空闲。我认为在ARC中我们不需要释放内存并释放东西(它甚至不会让我们释放)我认为它本身就完成了。

我从一些文章&线程,你可能有问题定义@properties,所以我有一些:

FirstViewController

@property (strong) FilterViewController *filterViewController;
@property (weak, nonatomic) IBOutlet MKMapView *mapView;
@property(nonatomic, retain) IBOutlet UILabel *sliderValue;

@property(nonatomic, retain) NSString *passedData;

@property int selectedTime;

FilterViewController

@property (nonatomic, retain) IBOutlet UIDatePicker *datePicker;
@property (strong, nonatomic) IBOutlet UILabel *stepperValueLabel;
@property (strong) FirstViewController *firstViewController;

1 个答案:

答案 0 :(得分:2)

你的问题是Retain cycle. firstViewController对象是保留filterViewController,而filterViewController对象是保留firstViewController

@property (strong) FirstViewController *firstViewController; in FilterViewController 
@property (strong) FilterViewController *filterViewController; in FirstViewController