Objective
Add proper memory alignment support to the TypeErasedComponentArray class to handle components with over-alignment requirements.
Acceptance Criteria
Dependencies
None currently identified, but this enhancement should be considered when:
- Supporting native C++ components with over-alignment in the future
- Expanding scripting support beyond .NET
- Performance optimizations requiring specific memory alignment
Technical Details
Environment: C++ ECS Component System
Components:
- engine/src/ecs/ComponentArray.hpp (TypeErasedComponentArray class declaration)
- engine/src/ecs/ComponentArray.cpp (TypeErasedComponentArray implementation)
Resources:
- std::aligned_alloc or operator new(size, alignment) for memory allocation
- Custom aligned allocator for std::vectorstd::byte
- Consider using alignas() specifications for future component types
Current implementation uses std::vectorstd::byte which only guarantees default alignment for std::byte. Components with alignas(64) or greater than alignof(std::max_align_t) may result in misaligned pointers and undefined behavior.
Backlink: Created from PR #352 discussion: #352 (comment)
Objective
Add proper memory alignment support to the TypeErasedComponentArray class to handle components with over-alignment requirements.
Acceptance Criteria
Dependencies
None currently identified, but this enhancement should be considered when:
Technical Details
Environment: C++ ECS Component System
Components:
Resources:
Current implementation uses std::vectorstd::byte which only guarantees default alignment for std::byte. Components with alignas(64) or greater than alignof(std::max_align_t) may result in misaligned pointers and undefined behavior.
Backlink: Created from PR #352 discussion: #352 (comment)