# Is it possible to allocate UObjects contiguously?

**URL:** <https://forums.unrealengine.com/t/is-it-possible-to-allocate-uobjects-contiguously/2423183>\
**Category:** C++\
**Tags:** uobject, unreal-engine, question, CPP\
**Created:** [March 28, 2025, 1:30am UTC](https://forums.unrealengine.com/t/is-it-possible-to-allocate-uobjects-contiguously/2423183 "2025-03-28T01:30:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Moon515](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Moon515](https://forums.unrealengine.com/u/Moon515)\
**Post date:** [March 28, 2025, 1:30am UTC](https://forums.unrealengine.com/t/is-it-possible-to-allocate-uobjects-contiguously/2423183/1 "2025-03-28T01:30:03Z")

</div>

Using TArrays doesn’t solve the problem as they will have a collection of pointers that are contiguous, but not the objects themselves. Heap fragmentation will occur. Just curious how the community handles this issue.

---

<div class="post-metadata">

**Author:** ![MagForceSeven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/magforceseven/32/906563_2.png) [@MagForceSeven](https://forums.unrealengine.com/u/MagForceSeven)\
**Post date:** [March 28, 2025, 1:49am UTC](https://forums.unrealengine.com/t/is-it-possible-to-allocate-uobjects-contiguously/2423183/2 "2025-03-28T01:49:16Z")

</div>

No.

> [@Moon515](#):
>
> Just curious how the community handles this issue

Frankly we just don’t worry about it when it comes to UObjects. If something needs the benefits of contiguous memory, we use something else. Like Mass. But for UObjects you just have to leave it up to the Engine. Even the large professional projects that I’ve worked on, don’t bother.

---

<div class="post-metadata">

**Author:** ![Moon515](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Moon515](https://forums.unrealengine.com/u/Moon515)\
**Post date:** [March 28, 2025, 2:31am UTC](https://forums.unrealengine.com/t/is-it-possible-to-allocate-uobjects-contiguously/2423183/3 "2025-03-28T02:31:21Z")

</div>

@MagForceSeven Wow, okay thanks. In your experience, is it possible to have a data oriented design approach in Unreal C++? By data oriented I mean focus on data locality (temporal and spatial), memory layout (SOA vs AOS), reduction of heap fragmentation, etc. Use of CPU cache and memory management.

Is trying a data oriented approach fighting with the engine, as philosophically, the engine never was designed with that approach in mind? I would imagine trying to use a data oriented approach would require rewriting parts of the engine to get the full advantage of this approach. But I would like some more insight from you or the wider community experienced with the engine. Especially Unreal C++.

---

<div class="post-metadata">

**Author:** ![MagForceSeven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/magforceseven/32/906563_2.png) [@MagForceSeven](https://forums.unrealengine.com/u/MagForceSeven)\
**Post date:** [March 28, 2025, 3:01am UTC](https://forums.unrealengine.com/t/is-it-possible-to-allocate-uobjects-contiguously/2423183/4 "2025-03-28T03:01:30Z")

</div>

Yeah, the majority of the engine isn’t really intended to work that way. There’s nothing that stops you from writing something yourself that way though. The engine is still C++ after all, so all of that is still at your disposal. Depending on how much or little of the engine you try to interact with.

It’s possible some of the lower level systems, like rendering or particle systems, do use those tools at some point in their implementations but not in a way that’s ever been obvious to me or made available to manipulate.

My understanding is that Mass is the intended solution for doing things in a data oriented way, but I haven’t messed with it myself. It’s a more recent addition to the toolkit provided by Epic.

For the sort of development I’ve done in the gameplay space, it’s never been an issue and a data oriented approach would likely not have provided any performance gains over the solutions we built using UObjects.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [April 27, 2025, 3:01am UTC](https://forums.unrealengine.com/t/is-it-possible-to-allocate-uobjects-contiguously/2423183/5 "2025-04-27T03:01:40Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
