objective c - Memory leaks because of MRR memory management -


i've got code no-arc project

@interface trssimagedownloader()  @property (nonatomic, retain) nsmutabledata *activedownloaddata;  @end @implementation trssimagedownloader  @synthesize activedownloaddata = _activedownloaddata;  -(id)init {        self = [super init];        if (self) {               _activedownloaddata = [nsmutabledata new];        }        return self; }  -(void)dealloc {     [_activedownloaddata release];     [super dealloc];  } 

it's working, when i'm testing through "profile"->"leaks", shows memory leaks on activedownloaddata

leaks tells leaked memory allocated. not tell failure correctly release is. either assign _activedownloaddata incorrectly somewhere else, or you're leaking of trssimagedownloader (and so, indirection, leaking _activedownloaddata).

the common cause of problem direct use of ivars. if use accessors everywhere (except init , dealloc), these problems tend go away easily. if use ivars directly inside of object, tend have these kinds of problems. without accessors, need audit every place assign ivar directly , make sure you're releasing old value correctly.

converting arc of course recommended solution if @ possible.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -