Does Clang / LLVM optimize memory use for auto-synthesized properties to avoid alignment padding? As far as I understand, an Objective-C object is basically a struct in memory, so an object like
@interface MyObj {
BOOL b;
id obj;
}
will have padding between b
and obj
in order to align obj
on a pointer-size boundary, while an object like
@interface MyObj2 {
id obj;
BOOL b;
}
does not need padding between obj
and b
, since BOOLs are naturally byte-aligned.
For auto-synthesized properties, how does Xcode lay out the backing ivars in memory? Will my objects use less memory if I manually order the ivars to improve their padding?