How do we use the memory profiler to track memory usage between matches?

Is there a good way to do this? Is there a way to automate this?

You can use the old memory profiler or the new stats based profiler.
At this moment I recommend using the old system which has a tool to compare the memory usage.

To enable:
In the BuildConfiguration.xml
add bUseMallocProfiler with true

Memory profiling is usually a manual process. If you want to automate this:

You need to add a new enumeration to EProfilingPayloadSubType after SUBTYPE_LicenseeBase
Add a new method like:

void FMallocProfiler::SnapshotMemoryMyNewEnumeration(const FString& Tag)
{
	if (GMallocProfiler && !GMallocProfiler->bEndProfilingHasBeenCalled)
	{
		GMallocProfiler->SnapshotMemory(SUBTYPE_SnapshotMarker_MyNewEnumeration, Tag);
	}
}

Between matches you need to call:
MALLOC_PROFILER( FMallocProfiler::SnapshotMemoryMyNewEnumeration( UniqueTag ); )

In the tool you need to add new marker here:
MemoryProfiler2.EProfilingPayloadSubType

If you reload a map between matches, you can probably use existing tag, like SUBTYPE_SnapshotMarker_LoadMap_Start

To automate this you need to change the tool, probably add functionality to dump memory usage between SUBTYPE_SnapshotMarker_LoadMap_Start, but memory profiler has visible overhead and running profiler throughout several matches may generate enormous files. Tool is written in C# and it’s kind of slow :slight_smile:
You should verify if automation process is really feasible.

Hi,

We think this post contains useful information which we would like to share with our public UE4 community. With your approval, we would like to make a copy of this post on the public AnswerHub which includes the discussion but strips out your username and company name. Please let us know if you are okay with this.

Thanks!

Yeah sure. Thanks for the answer.