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.
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- Get the NSRange for the visible text after scroll
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Swift - hide pickerView after value selected
- Popover segue to static cell UITableView causes co
- How do you detect key up / key down events from a
- didBeginContact:(SKPhysicsContact *)contact not in
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.
You can also find this way:
Objective C
Swift 4
Might be useful to convert to NSData if your dictionary contains standard classes (eg. NSString) and not custome ones:
The best way to calculate the size of big
NSDictionary
, I think, would be converting it toNSData
and get the size of the data. Good Luck!