开发者

Returning an array without a Leak!

开发者 https://www.devze.com 2023-02-08 23:49 出处:网络
[sender LoadDataComplete:arrDetailData]; I am returning this array like this from an objective C class in my my class which inherits ViewController...if I write [ar开发者_如何学JAVArDetailData release

[sender LoadDataComplete:arrDetailData]; I am returning this array like this from an objective C class in my my class which inherits ViewController...if I write [ar开发者_如何学JAVArDetailData release] below this...i get crash... Please advise on it...how to get this array without a leak


Why don't you autorelease it ?


@devaditya you should use autorelease instead of release

[arrDetailData autorelease];

you can write this statement before the return statement.


when you are using [array relese] it will release the object very soon it may crash your app..so use autorelese..If you mean you want to remove the objects from array use [array RemoveAllobjects].. Refer about memory management

0

精彩评论

暂无评论...
验证码 换一张
取 消