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.
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.
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).
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?