I’m currently developing a sprawling open-world RPG in Unreal Engine 5, and I am hitting massive frame drops when loading new grid cells. I've tried using World Partitioning, but my RAM usage spikes to 95% almost instantly. Does anyone have advanced tips for manual memory management or custom allocators in C++ to handle high-fidelity asset streaming without stuttering? I need to know how to better manage pointers and garbage collection cycles to keep the FPS stable at 60.
3 answers
Transitioning to a data-oriented design using the Entity Component System (ECS) mindset can drastically help. In UE5, ensure you are leveraging the ‘Mass’ framework for large-scale actor management. I found that strictly using TWeakPtr instead of hard object references for distant assets prevented the Garbage Collector from holding onto memory longer than necessary. Also, try implementing a custom pooling system for frequently spawned actors like projectiles or NPCs to reduce the overhead of constant memory allocation and deallocation during gameplay.
Are you currently using the Virtual Assets feature in UE5 to reduce the initial load footprint, or are you still relying on traditional asset loading?
You should look into 'Double Buffering' your data streams so the CPU isn't waiting on the storage drive to catch up during a cell load.
I agree with Robert; asynchronous loading is key. Using FStreamableManager to handle your loads in the background is the standard industry practice for this.
Yes, Michael, I started using Virtual Assets last month. It helped with disk space, but the runtime memory pressure is still my main bottleneck during cell transitions. I suspect my custom C++ classes are holding onto heavy UObject references. I’m looking into using Soft Object Paths to see if deferred loading can mitigate these specific 95% spikes we're seeing.