Need help locating which method to dealloc


#1

I am trying to do the last step in the memory management and there is no reference as to where I put the code. I have put it in several places and I get two warnings, so I know it’s not in the correct spot in Possession.m

Here is the code patch I’m referring to:

- (void)dealloc { [possessionName release]; [serialNumber release]; [valueInDollars release]; [dateCreated release]; }

This is a screen shot showing the errors:

I had no errors or warnings until I tried this final memory problem and the only reference the book gives me is it has to go at the end of the method… I’m not experienced enough to follow that vague of a directive… I need to know where exactly, and what method.

The book’s technique of showing a patch of code in a regular type face along with the bold needed to be entered was done everywhere up until this entry, and without it I can’t finish this code project.

Any help here would be appreciated. Keep in mind I’m only at the front of the book and as you can tell not that experienced yet --so as easy as you can describe it the better.

Many thanks,

–Rob


#2

I’m also a little confused on where to place the code and the procedure to dealloc…
dealloc instance variables and then call the superclass dealloc at the end of all methods? instance methods? description methods?


#3

Hi,

The first problem is that you try to release an int (valueInDollars), remove: [valueInDollars release]; from the dealloc method
The second problem is that you should add: [super dealloc]; to the dealloc method.

Then you should be good to go.