A: 

Try [dictAttributes removeAllObjects] before releasing dictAttributes.

Edit:

Also, you will positive allocation because you are allocating memory for "tmp". The memory will be retained because you now have a reference from dictAttributes.

You then have more positive allocation when you add elements to the dictionary, which also need to be allocated and are kept in memory by the dictionary's internal references

vdeych
Good idea - I assumed that when you release an NSDictionary, all its objects are freed as well - as per NSArray.
A: 

Typical syntax is NSMutableDictionary *tmp = [[[NSMutableDictionary alloc] init] autorelease];

Matt Williamson
Not necessarily. This alloc/init/assign-to-property/release pattern is common, especially in Apple sample code.
Shaggy Frog
I read somewhere that autorelease should not be used for iPhone projects - is this correct? I mean, there is no knowing when the object will be released and it could be released when you need it (especially when returning objects from functions/methods.
The Apple documentation says you shouldn't use autorelease, but the rest of the documentation is riddled with it.
Matt Williamson
A: 

When you have strings as properties, declare them as copy, not retain.

  NSMutableDictionary *tmp = [[NSMutableDictionary alloc] init];
  self.dictAttributes = tmp;
  [tmp release];

the above is unnecessary, instead do: (retain count will automatically be incremented for this autorelease object)

self.dictAttributes = [NSMutableDictionary dictionaryWithCapacity:0];

in dealloc do: (retain count will automatically be decremented)

self.dictAttributes = nil;

normally for properties you just set them to nil instead of explicitly releasing them since the get/setter handles that for you.

Anders K.
What is the reason for not declaring a property of type NSString using retain?
because you can assign a NSMutableString to the property, meaning the original string may after the assignment be altered - so its better to take a one time copy of it to prevent weird errors.
Anders K.