# EQS Query eating up memory

**URL:** <https://forums.unrealengine.com/t/eqs-query-eating-up-memory/412221>\
**Category:** Community & Industry Discussion\
**Tags:** leak, possible-bug, EQS, unreal-engine, question\
**Created:** [December 14, 2017, 8:14am UTC](https://forums.unrealengine.com/t/eqs-query-eating-up-memory/412221 "2017-12-14T08:14:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_49a519741](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_49a519741](https://forums.unrealengine.com/u/anonymous_user_49a519741)\
**Post date:** [December 14, 2017, 8:14am UTC](https://forums.unrealengine.com/t/eqs-query-eating-up-memory/412221/1 "2017-12-14T08:14:32Z")

</div>

Hi,

Is there something in EQS that I’m supposed to clean up? I am running a query (from the pawn, not the BT) and with 4 bots I am watching the memory usage go up at about 10MB per second. Is it a leak I need to plug or is the GC just letting things accumulate? It has me worried.

I can run an alternative to the EQS and the memory usage is stable. I run the EQS only (not the code that uses the results) and the memory usage goes up. So it’s the EQS for sure. And I have a custom test but the problem still happens when I disable it in the query.

I saw another post ([Memory leak when using EnvQuery copies - AI - Epic Developer Community Forums](https://answers.unrealengine.com/questions/467367/memory-leak-when-using-envquery-copies.html)) but it wasn’t helpful.

I’m building the engine in debug so maybe I can figure out why its happening. I just figured maybe it was something I wasn’t doing, like cleaning up the query instance after the node that runs the query somehow.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_49a519741](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_49a519741](https://forums.unrealengine.com/u/anonymous_user_49a519741)\
**Post date:** [December 14, 2017, 8:29am UTC](https://forums.unrealengine.com/t/eqs-query-eating-up-memory/412221/2 "2017-12-14T08:29:52Z")

</div>

REWRITE:

I thought this was resolved because the memory usage caps out. See my comments below. While this isn’t a memory leak, it is an issue with GC (IMO).

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_49a519741](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_49a519741](https://forums.unrealengine.com/u/anonymous_user_49a519741)\
**Post date:** [December 14, 2017, 8:49am UTC](https://forums.unrealengine.com/t/eqs-query-eating-up-memory/412221/3 "2017-12-14T08:49:48Z")

</div>

I should say, tho. It’s not bad in the editor – caps out around 1.5GB. But my server eats up over 4GB before the GC kicks in and drops it down to ~200MB. It may not be getting handled efficiently.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_49a519741](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_49a519741](https://forums.unrealengine.com/u/anonymous_user_49a519741)\
**Post date:** [December 20, 2017, 1:34am UTC](https://forums.unrealengine.com/t/eqs-query-eating-up-memory/412221/4 "2017-12-20T01:34:21Z")

</div>

Additional note: This is happening because I am running the EQS query from a Service. The Service runs four times per second. My query is pretty light so I thought it would be fine to do this. But the stutter I get from the GC clearing 4GB is a problem. It really should be reusing – or recycling or something – earlier than it is. I don’t suppose any Epic devs would look into this. Or, tell me why it will never work.
