# How to debug memory usage/Garbage collector?

**URL:** <https://forums.unrealengine.com/t/how-to-debug-memory-usage-garbage-collector/484845>\
**Category:** Debugging, Optimization, & Profiling\
**Tags:** garbage-collector, actor, Destroy-Actor, unreal-engine, memory, question\
**Created:** [June 13, 2021, 5:24pm UTC](https://forums.unrealengine.com/t/how-to-debug-memory-usage-garbage-collector/484845 "2021-06-13T17:24:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![somawheels](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@somawheels](https://forums.unrealengine.com/u/somawheels)\
**Post date:** [June 13, 2021, 5:24pm UTC](https://forums.unrealengine.com/t/how-to-debug-memory-usage-garbage-collector/484845/1 "2021-06-13T17:24:51Z")

</div>

I am having an issue where data associated with actors does not disappear when the actors are destroyed.

I Understand UObjects are supposed to be garbage collected when no references to them exist, however mine clearly are not being garbage collected, and i cant figure out why. My game just uses more and more ram the longer it runs.

Are there tools/techniques i can use to fix this?

---

<div class="post-metadata">

**Author:** ![CtnDev](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ctndev/32/1133321_2.png) [@CtnDev](https://forums.unrealengine.com/u/CtnDev)\
**Post date:** [June 13, 2021, 7:57pm UTC](https://forums.unrealengine.com/t/how-to-debug-memory-usage-garbage-collector/484845/2 "2021-06-13T19:57:25Z")

</div>

Try

```
GetWorld()->ForceGarbageCollection(true);

```

to force. But any UObject required to be reuse can create crash. Only do when you %100 sure objects wont be used.
