Memory tracking

I just wrote a blog post where I look at the memory tracking features in Unreal Engine 4 after my experience with them working in a AAA sandbox game.

Since this is going to be a series of blog posts I will keep an index here for future reference. Next time I will write about writing and alternative allocator to improve memory tracking. Hope you will find them useful.

Thanks.

Heya,

Thanks for the post!

As a heads up, GetResourceSize isn’t meant to be used in isolation and generally does not include numbers for other tracked objects as well (although it can, as long as it still reports 0 for them when called in Exclusive mode), which is why it doesn’t include self size / etc…

There are probably still a number of places where the implementations are missing tracking, but the sizeof(USkeletalMesh) itself, along with memory in TArrays and any other reflected members that can be reached via serialization will all be included in an obj dump in the NumKBytes column; the ResKBytes is mainly for non-serialization reachable data. Morph targets and other referenced UObjects are intentionally excluded to avoid double-counting memory when assets are shared.

Cheers,
Michael Noland

Hello Michael,

That makes sense but all of the caveats of the actual number make it unreliable for the objective of determining what should be optimized. Also there is the gap of memory allocated on stuff that isn’t serialized either. So my idea is to improve that without having to make specific distinctions about serializable vs non-serializable data, etc. Every allocation of memory should be accounted for with proper context data for the allocation.

I’ll love to hear your opinion once I expand on the solution which I will be writing on soon (probably before I go to the GDC).

Thanks.

I wrote some thoughts on how memory allocation and tracking should be done. Did I forget something? https://pzurita.wordpress.com/2015/02/17/memory-allocation-and-tracking/

I will be streaming at [) as I work on this at 7:00PM GMT -3 / 3:00PM PDT. That would be in 40 minutes.

[)

I will be streaming as I work on memory tracking for Unreal Engine 4.8 at 4:00PM GMT -3 / 12:00PM PDT.

Day 5 of streaming as I work on this.

In this video I cover the work to add the thread name to the data and dumping the data to a file.

In this video I cover the work to add the support for scope stacks which allow to define some context to each allocation.

I really wish Epic would have integrated this, your solution looks awesome. Tracking memory is really annoying with UE4 at the moment. Does Epic have any plans to improve this?