# How optimize memory use on executor

**URL:** <https://community.dremio.com/t/how-optimize-memory-use-on-executor/2519>\
**Category:** Uncategorized\
**Created:** [January 10, 2019, 9:37pm UTC](https://community.dremio.com/t/how-optimize-memory-use-on-executor/2519 "2019-01-10T21:37:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bruno\_Mata](https://avatars.discourse-cdn.com/v4/letter/b/d2c977/32.png) [@Bruno\_Mata](https://community.dremio.com/u/Bruno_Mata)\
**Post date:** [January 10, 2019, 9:37pm UTC](https://community.dremio.com/t/how-optimize-memory-use-on-executor/2519/1 "2019-01-10T21:37:37Z")

</div>

Hi,

We are using dremio with one coordinator and one executor about a month. The results we’re getting are great, but recently I did some stressful queries to test executor capabilities and received a “IllegalStateException: Memory was leaked by query. Memory leaked: (66560)”. Ok, this was the objective, but I noticed, by using jconsole to track jmx metrics how dremio doc suggest, that use of memory do not pass 1.5Gb (heap and non-heap).

My executor setup is a aws c5.2xlarge that have 16Gb of memory.

My dremio-env is with DREMIO\_MAX\_MEMORY\_SIZE\_MB=16384

So my question is, are there any setting I forgot? Because, I’m getting a memory error but there is a lot of memory available on server.

thanks,

---

<div class="post-metadata">

**Author:** ![laurent](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/laurent/32/16_2.png) [@laurent](https://community.dremio.com/u/laurent)\
**Post date:** [January 10, 2019, 9:58pm UTC](https://community.dremio.com/t/how-optimize-memory-use-on-executor/2519/2 "2019-01-10T21:58:24Z")

</div>

Dremio uses two kinds of memory: heap and direct. With 16GB of memory configured, you would get 14gb/2gb heap/direct memory for a standalone coordinator, 4gb/12gb of heap/direct memory for an executor.

As for this message, it only pertains to direct memory (not heap), and you should be able to identify which query(ies) cause this leak, as Dremio creates a separate allocator for each query. If you can share profiles of the query to help us identify the cause of the leak, this would be very helpful.
