# Garbage Collector Guarantees

**URL:** <https://forums.unrealengine.com/t/garbage-collector-guarantees/320549>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [June 2, 2015, 11:15pm UTC](https://forums.unrealengine.com/t/garbage-collector-guarantees/320549 "2015-06-02T23:15:50Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![anonymous\_user\_8e2766aa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8e2766aa](https://forums.unrealengine.com/u/anonymous_user_8e2766aa)\
**Post date:** [June 9, 2015, 6:15pm UTC](https://forums.unrealengine.com/t/garbage-collector-guarantees/320549/2 "2015-06-09T18:15:20Z")

</div>

Hello,

To ensure that the object will be properly handled in terms of Garbage Collection (in other words, it won’t get deleted while still being referenced in your code), please make sure that the following conditions are met:

1. You use UObject and UObject-derived objects (in other case, please use Smart Pointers);

2. Your class members are declared as UPROPERTY;

Please also note that the only type-safe container is TArray.

If you like to learn more about Garbage Collection in Unreal Engine 4, please go here:

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — https://unrealcommunity.wiki/! You will be able to find content from...

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — https://unrealcommunity.wiki/! You will be able to find content from...

Hope this helped!

Cheers!

---

_[View the full topic](https://forums.unrealengine.com/t/garbage-collector-guarantees/320549)._
