Skip to content

Instantly share code, notes, and snippets.

@jkubicek
Last active December 11, 2015 07:58
Show Gist options
  • Save jkubicek/4569613 to your computer and use it in GitHub Desktop.
Save jkubicek/4569613 to your computer and use it in GitHub Desktop.
How big is a UIView?
UIView *view = [[UIView alloc] init];
NSData *objData = [NSData dataWithBytes:(__bridge const void *)(view) length:malloc_size(view)];
NSLog(@"Object contains %@", objData);
/*
Code via http://mikeash.com/pyblog/friday-qa-2009-03-13-intro-to-the-objective-c-runtime.html
Output:
Object contains <bc8d7f00 603f6507 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 200000c0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000>
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment