I was looking at an nsCxPusher which contains a Maybe<nsAutoCxPusher> which itself contains a Maybe<nsJSAutoRequest> and a Maybe<nsJSAutoCompartment>. nsJSAutoRequest just contains a pointer, so its size is 4. But sizeof(Maybe<nsJSAutoRequest>) is 16, so it's 68% empty! The irony is that my nsCxPusher only had 4-byte alignment all along.
We ought to be using something like AlignedElem<sizeof(T)> instead of AlignedStorage2<T>; the only problem is that there exist compilers for which AlignedElem<> won't actually be aligned. We could make MOZ_ALIGNED_DECL just #error out for those compilers, or we could choose between AlignedElem<> and AlignedStorage2<T> depending on the compiler.
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1287006
You need to log in before you can comment on or make changes to this bug.