I don't know if this affects your issue, but it is worth knowing...
NSNumber does some fancy things behind the scenes, especially for the integers 0 - 12. It doesn't always release them, since it assumes that it is highly likely that it will need to reuse them in the future. They are considered to be used commonly enough to not want to retain / delete them all of the time.
See this discussion.
This might account for a little bit of memory not getting released, but it won't account for a huge amount.
It would be interesting to put your above code in a for loop, and see if calling it many times increases memory, or if the amount of memory used stays flat.
for (int i = 0; i < 100; i++) {
@autoreleasepool {
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
for (int i = 0; i < 300000; i++) {
@autoreleasepool {
[dict setObject:[NSNumber numberWithInt:i] forKey:[NSNumber numberWithInt:i]];
}
}
[dict removeAllObjects];
}
}
If it stays flat, I wouldn't worry too much about it.