I'm going to say that's the problem. trackName is autoreleased.
By the way, comment "when i click "back button" on the navigationcontroller" would have been a useful piece of information before. That's most likely when the autorelease pool is getting drained. I thought you meant you were literally crashing at the aforementioned line of code.
I have fixed the things you said, but when i try to release trackDictionary, it still crashes when i click "back button". very weird.
Well, I don't know what else to tell you. Probably time for you to do to a thorough review of your code, line by line, and double check all of the little things we've talked about in this thread. Release if you did an alloc/init, don't if you didn't, etc.
I just don't see how trackDictionary can be an autoreleased object, so I'm almost positive the problem is somewhere else.
I have fixed the things you said, but when i try to release trackDictionary, it still crashes when i click "back button". very weird.
but if i dont release it, its fine.
So I don't think the problem is that you are over-releasing the dictionary. The problem is you are over-releasing items in the dictionary. By not releasing the dictionary itself, you are just masking the problem.
For example look at this:
Code:
NSMutableArray *triparray = [[self trackDict] objectForKey:kTripKey];
[self setCurrentTrackTripArray:triparray];
[triparray release]; // You shouldn't be doing this.
You don't want to be releasing triparray there. There may be other cases of this as well, so if you clean those up then you should be able to release the dictionary after setTrackDict, which is the right thing to do.
Hope that helps. If not, please post the current version of the code including all the new changes you've incorporated.
So I don't think the problem is that you are over-releasing the dictionary. The problem is you are over-releasing items in the dictionary. By not releasing the dictionary itself, you are just masking the problem.
For example look at this:
Code:
NSMutableArray *triparray = [[self trackDict] objectForKey:kTripKey];
[self setCurrentTrackTripArray:triparray];
[triparray release]; // You shouldn't be doing this.
You don't want to be releasing triparray there. There may be other cases of this as well, so if you clean those up then you should be able to release the dictionary after setTrackDict, which is the right thing to do.
Hope that helps. If not, please post the current version of the code including all the new changes you've incorporated.
Yes you are absolutely right! you have fixed my problem. thanks alot for all.
triparray should be autoreleased, isnt it.
Yes you are absolutely right! you have fixed my problem. thanks alot for all.
triparray should be autoreleased, isnt it.
Well, it's not really autoreleased here, because objectForKey doesn't retain it. So there is no need to autorelease it. And no need for you to release it either.
I found on iTunes, the Stanford University iPhone class videos to be very helpful. They have a great one which deals with memory and releasing object that really cleared up a lot for me.
If you go to iTunes, I think a search on Stanford and iPhone should return those videos.