Hey!
While looking into memory usage, I noticed that a recent change from 5.7 has increased the class size of UActorComponent and created padding holes https://github.com/EpicGames/UnrealEngine/commit/49b51620a681c3615e88f2d7cac45b48d75576ee
Code was changed from:
/** Used for fast removal of end of frame update */
int32 MarkedForEndOfFrameUpdateArrayIndex;
To:
/** Used for fast removal of end of frame update */
int32 MarkedForEndOfFrameUpdateArrayIndex : 28;
/** Tracks whether the component has been added to one of the world's end of frame update lists */
uint8 MarkedForEndOfFrameUpdateState : 2;
/** Tracks whether the component supports an early end of frame update. */
uint8 bReadyForEarlyEndOfFrameUpdate : 1;
/** Tracks whether the component is currently being updated or is scheduled for an async update. */
uint8 bRenderStateUpdating : 1;
Seems the intent was to try and reduce MarkedForEndOfFrameUpdateArrayIndex from 32 to 28 bits and reuse the last 4 bits for those track variables, but c++ doesn’t allow bitfielding different types (int32 != uint8), so it creates a padding hole as can be seen in crunchersharp:
Would be good to see this fixed, as UActorComponent is instantiated a lot!
As a bonus, the enum class below (EComponentRegistrationState) doesn’t have a specified underlying type, so it is using 4 bytes, when it could be using one if forced on a uint8, would be great to see that change upstream as well ![]()
Thanks!
Lambert
