Sunday, 15 August 2010

iphone - Variable memory address attribution EXEC_BAD_ACESS -



iphone - Variable memory address attribution EXEC_BAD_ACESS -

i have allocated object attributes store in next memory places:

when create simple attribution of nsdate attribute variable gives me exec_bad_acess. can see first image date attribute , filedate variable have different addresses.

am making pointer related error? other 2 attributes assigned correctly variables, happens nsdate maybe i'm missing detail nsdate.

edit1

downloadfile definition:

edit2

init function:

edit3 date parameter:

is there reason why not using arc? there quite few memory management errors there causing leaks , 1 should cause crash.

nsdate *datefromstring = [dateformatter datefromstring:receiveddate];

returns autoreleased nsdate when phone call additional

[datefromstring autorelease];

you overreleasing nsdate hence crash.

[pfile setdate:[[nsdate alloc] init]];

is memory leak. going through setter setdate: cause pfile take +1 retain on date, should release in it's dealloc. [[nsdate alloc] init] phone call returns date object +1 never released elsewhere.

you can prepare either with

[nsdate date]

or

[[[nsdate alloc] init] autorelease];

the first alternative preferred

iphone objective-c pointers nsdate exc-bad-access

No comments:

Post a Comment