How to calculate total size of NSDictionary object?
ios, ios5, ios6, malloc, sizeof
Solution
You could try to get all the keys of the Dictionary in an array and then iterate the array to find the size, it might give you the total size of the keys inside the dictionary.
NSArray *keysArray = [yourDictionary allValues];
id obj = nil;
int totalSize = 0;
for(obj in keysArray)
{
totalSize += malloc_size(obj);
}
Problem
How to calculate total size of `NSDictionary` object? i have 3000 StudentClass objects in `NSDictionary` with different keys. And i want to calculate total size of dictionary in KB. I used `malloc_size()` but it always return 24 (`NSDictionary` contain either 1 object or 3000 object) `sizeof()` also returns always same.