# How to turn garbage collection off?

**URL:** <https://forums.unrealengine.com/t/how-to-turn-garbage-collection-off/365413>\
**Category:** Debugging, Optimization, & Profiling\
**Tags:** Optimization, unreal-engine, UE4, CPP, question\
**Created:** [July 28, 2016, 1:58pm UTC](https://forums.unrealengine.com/t/how-to-turn-garbage-collection-off/365413 "2016-07-28T13:58:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![redhatdragon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redhatdragon](https://forums.unrealengine.com/u/redhatdragon)\
**Post date:** [July 28, 2016, 1:58pm UTC](https://forums.unrealengine.com/t/how-to-turn-garbage-collection-off/365413/1 "2016-07-28T13:58:52Z")

</div>

Is there any way to turn the garbage collector off? It’s a huge turn off for people who want to optimize.  
Thanks in advance for any advice. Hope this gets a solution soon.

EDIT 1:  
Removed rant.lol

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [July 29, 2016, 12:59am UTC](https://forums.unrealengine.com/t/how-to-turn-garbage-collection-off/365413/2 "2016-07-29T00:59:25Z")

</div>

Start UE4 application (this includes editor) with `-NoVerifyGC` option

---

<div class="post-metadata">

**Author:** ![redhatdragon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redhatdragon](https://forums.unrealengine.com/u/redhatdragon)\
**Post date:** [July 31, 2016, 12:03am UTC](https://forums.unrealengine.com/t/how-to-turn-garbage-collection-off/365413/3 "2016-07-31T00:03:31Z")

</div>

So if i understand correctly i would go to the directory where ue4 is in command prompt and just type in “UE4Editor -NoVerifyGC”? huh i should look for a list of options… maybe there’s some other argument i could use. but i appreciate the help and if this works i’ll quickly give you the answer and +1:)

---

<div class="post-metadata">

**Author:** ![redhatdragon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redhatdragon](https://forums.unrealengine.com/u/redhatdragon)\
**Post date:** [July 31, 2016, 12:12am UTC](https://forums.unrealengine.com/t/how-to-turn-garbage-collection-off/365413/4 "2016-07-31T00:12:12Z")

</div>

crap i can’t find any signs that this argument is even working. i’ll need a little bit to setup a good test to benchmark this. but in the meantime +1 for trying to help. will report back with the results in a day or so.

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [July 31, 2016, 3:05am UTC](https://forums.unrealengine.com/t/how-to-turn-garbage-collection-off/365413/5 "2016-07-31T03:05:18Z")

</div>

Well check this out

> **[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...

You can disable object from auto deleting by adding it to root

---

<div class="post-metadata">

**Author:** ![redhatdragon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redhatdragon](https://forums.unrealengine.com/u/redhatdragon)\
**Post date:** [August 5, 2016, 2:46pm UTC](https://forums.unrealengine.com/t/how-to-turn-garbage-collection-off/365413/6 "2016-08-05T14:46:32Z")

</div>

This looks very useful. and from what i’m seeing it appears that the garbage collector won’t even realize there’s another object being created… therefore there’s no extra references attached to the object and the garbage collector won’t even check for it. This is gold. Thank you very much. also to the thing mentioned in your answer i’m starting to think that’s a link option i’m supposed to add. It looks a lot like it.

---

<div class="post-metadata">

**Author:** ![redhatdragon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redhatdragon](https://forums.unrealengine.com/u/redhatdragon)\
**Post date:** [August 5, 2016, 2:48pm UTC](https://forums.unrealengine.com/t/how-to-turn-garbage-collection-off/365413/7 "2016-08-05T14:48:16Z")

</div>

I’m just now getting into using gcc(despite already knowing asm) so that did throw me off a bit.

---

<div class="post-metadata">

**Author:** ![Max\_Pixel\_FFL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Max\_Pixel\_FFL](https://forums.unrealengine.com/u/Max_Pixel_FFL)\
**Post date:** [September 26, 2019, 10:01pm UTC](https://forums.unrealengine.com/t/how-to-turn-garbage-collection-off/365413/8 "2019-09-26T22:01:22Z")

</div>

This answer is incorrect and should be marked as such. Unfortunately, I don’t yet have enough rep to downvote it. `-NoVerifyGC` does **NOT** turn off garbage collection.

Some objects are marked as “disregard for GC”; these objects are assumed to not reference any objects outside of their group, which allows the garbage collector to work more quickly by ignoring those objects during certain parts of the collection routine. Development and editor builds will double-check these objects anyways - this is called “GC verification”, because it verifies that the assumptions are correct. The `NoVerifyGC` flag skips that safety check in dev builds, making them behave like shipping builds in terms of this particular subsystem.

In short `NoVerifyGC` says “assume that everything is peachy with our disregarded objects, don’t bother double-checking for references because your double-checking is messing with my profiler”.
