When I use this statement in objective c
NSObject object = [[NSObject alloc] init];
How much memory is reserved for object?
You can test the size of objects with the following code:
#import <malloc/malloc.h>
//...
NSObject *obj = [[NSObject alloc] init];
NSLog(@"Size: %zd bytes", malloc_size((__bridge const void *)(obj)));
This test produced: "Size: 16 bytes"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With