RealDocs

FName::Reserve

function Core Since 4.0
#include "UObject/NameTypes.h"
Access: public Specifiers: static

Description

Pre-allocates memory in the global FName table to reduce reallocations during bulk name registration. Call this before large batch operations such as map loading, asset import, or initial network connection.

Caveats & Gotchas

  • Reserving more than needed wastes memory but is otherwise harmless. Under-reserving still works — the table grows naturally; this is purely a performance hint.
  • This only reserves capacity; it does not prevent re-hashing if actual registrations significantly exceed NumNames. Pair with DisplayHash to verify the reservation was adequate.

Signature

CORE_API static void Reserve(uint32 NumBytes, uint32 NumNames);

Parameters

Name Type Description Default
NumBytes uint32 Approximate number of bytes to pre-allocate in the string data store.
NumNames uint32 Approximate number of name entries to pre-allocate slots for.

Return Type

void

Example

Reserve before bulk asset registration C++
// Hint to the engine before registering names for ~10,000 assets
FName::Reserve(512 * 1024, 10000);
for (const FString& AssetPath : AssetPaths)
{
    FName AssetName(*FPaths::GetBaseFilename(AssetPath));
    // AssetName is now registered with fewer table reallocations
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.