<aside> 🗒️ Part of Ari's Unreal Engine Notes.

</aside>

Unreal replaces C++'s allocators with its own in REPLACEMENT_OPERATOR_NEW_AND_DELETE in ModuleBoilerplate.h. There all memory allocations will go through Unreal's FMemory::Malloc which gets overridden, like in FMallocBinned2::Malloc(..).

Each platform can declare which allocator they use starting in FMemory::GCreateMalloc and FPlatformMemory::BaseAllocator(). In FWindowsPlatformMemory::BaseAllocator for example, it creates an FMallocBinned2. All allocations will go through the chosen allocator.

Smaller allocations get put into bins of various sizes to get around memory fragmentation, while bigger allocations get forwarded directly to the OS.

I recommend looking at the Garbage Collector as it touches so much on UObjects and their lifetime, check out CollectGarbageInternal(..) in GarbageCollection.cpp.