# How does Load Game from Slot work?

**URL:** <https://forums.unrealengine.com/t/how-does-load-game-from-slot-work/628497>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [August 15, 2022, 1:44am UTC](https://forums.unrealengine.com/t/how-does-load-game-from-slot-work/628497 "2022-08-15T01:44:14Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_b04a32c1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b04a32c1](https://forums.unrealengine.com/u/anonymous_user_b04a32c1)\
**Post date:** [August 15, 2022, 1:44am UTC](https://forums.unrealengine.com/t/how-does-load-game-from-slot-work/628497/1 "2022-08-15T01:44:14Z")

</div>

1- **Does it create a save game object?**

2- **And on that note, do you need to manually destroy the save game object once you are done with saving the game, or is the object only temporary for your request**

If you are loading thousands of games from slots it becomes meaningful knowing this.

So yeah, both of those questions.

---

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [August 15, 2022, 3:35am UTC](https://forums.unrealengine.com/t/how-does-load-game-from-slot-work/628497/2 "2022-08-15T03:35:35Z")

</div>

1. If you are talking about LoadGameFromSlot from the UGameplayStatics library:

```auto
bool UGameplayStatics::LoadDataFromSlot(TArray<uint8>& OutSaveData, const FString& SlotName, const int32 UserIndex)
{
	ISaveGameSystem* SaveSystem = IPlatformFeaturesModule::Get().GetSaveGameSystem();
	// If we have a save system and a valid name..
	if (SaveSystem && (SlotName.Len() > 0))
	{
		if (SaveSystem->LoadGame(false, *SlotName, UserIndex, OutSaveData))
		{
			return true;
		}
	}

	// Clear buffer on a failed read
	OutSaveData.Reset();
	return false;
}

```

Normally that will use a generic save game system:

> \UE\_4.27\Engine\Source\Runtime\Engine\Public\SaveGameSystem.h

Which reads data from file and stores the relevant data to a property:

```auto
TArray<uint8>& OutSaveData

```

Some of the other methods work with USaveGame like LoadGameFromMemory.

1. If you create a local property its memory will be managed automatically as long as you don’t use the “new” word to create it.

> [@anonymous\_user\_b04a32c1](#):
>
> If you are loading thousands of games from slots

You should never have to do that. If you just want to know if a slot exists or not you can use the relevant methods on UGameplayStatics to check for them without loading any savegame. The only memory used of course are those of the classes you reference if the references are not soft.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b04a32c1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b04a32c1](https://forums.unrealengine.com/u/anonymous_user_b04a32c1)\
**Post date:** [August 16, 2022, 3:08pm UTC](https://forums.unrealengine.com/t/how-does-load-game-from-slot-work/628497/3 "2022-08-16T15:08:32Z")

</div>

But sometimes you do need to load thousands of games from slots, different slots, that do exist.  
So, do yu happen to know if it creates a new object which must then be deleted? or is it only a way for you to access the actual .sav file in disk.

---

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [August 16, 2022, 11:24pm UTC](https://forums.unrealengine.com/t/how-does-load-game-from-slot-work/628497/4 "2022-08-16T23:24:12Z")

</div>

It would help if you gave a few specific examples so I can give a more specific answer. Normally you don’t load more than a few USaveGame objects at all and those are used only temporarily. If you are wondering about showing thousands of save games in a list on the UI then no you don’t have to load everything in all save games to just display basic UI data for them.

> [@anonymous\_user\_b04a32c1](#):
>
> a new object which must then be deleted

(U)Objects are automatically garbage collected when nothing references them. You can work with USaveGame objects looping over your save game slots and forget about them afterwards. Properties of basic types will also be freed automatically if you don’t create them with the “new” keyword which we never really do.

> [Garbage Collection & Dynamic Memory Allocation - Old UE4 Wiki](https://nerivec.github.io/old-ue4-wiki/pages/garbage-collection-dynamic-memory-allocation.html)

> [Reddit - Dive into anything](https://www.reddit.com/r/unrealengine/comments/i8sahr/garbage_collection_of_variables/)

> [Memory Management & Garbage Collection in Unreal Engine 5 | Mikelis' Game Blog](https://mikelis.net/garbage-collection-in-unreal-engine-c3ebcfdff6a0)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b04a32c1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b04a32c1](https://forums.unrealengine.com/u/anonymous_user_b04a32c1)\
**Post date:** [August 21, 2022, 10:06pm UTC](https://forums.unrealengine.com/t/how-does-load-game-from-slot-work/628497/5 "2022-08-21T22:06:20Z")

</div>

@Roy_Wierer.Seda145  
Hi, I did some tests and the objects continue to exist after the save game or load game is done.  
I have tried checking after a whole minute, without promoting them to a variable or anything, and they still exist.  
And destroy actor doesn’t seem to work on them, so I have no Idea how to get rid of these objects once they are created. And this is a BIG problem.

---

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [August 21, 2022, 10:25pm UTC](https://forums.unrealengine.com/t/how-does-load-game-from-slot-work/628497/6 "2022-08-21T22:25:14Z")

</div>

I suppose they must be referenced somewhere. If they were not referenced anywhere the Garbage Collector would automatically collect them and nullptr any pointers afterwards according to documentation. Garbage collector runs at configurable intervals, I believe the default is 30 seconds.

---

<div class="post-metadata">

**Author:** ![ShadowBr0kerz](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shadowbr0kerz/32/1201558_2.png) [@ShadowBr0kerz](https://forums.unrealengine.com/u/ShadowBr0kerz)\
**Post date:** [September 6, 2026, 3:06pm UTC](https://forums.unrealengine.com/t/how-does-load-game-from-slot-work/628497/7 "2026-09-06T15:06:49Z")

</div>

Load Game from Slot deserializes the file into a new USaveGame object each call - it doesnt reuse a cached object, and you dont need to manually destroy it since its garbage collected once unreferenced. for thousands of loads just avoid holding refs in variables or memory grows til GC runs. for frequent listing at scale loading every full save just to get names gets slow, which is why metadata helps. advanced save system from fab [Save System / Cloud Save / Encryption / Slot management | Fab](https://www.fab.com/listings/1268f6a9-7ba8-4f30-91b8-73618d593252) exposes slot enumeration with timestamp/playtime/version/size so you can build lists without deserializing every file
