# Elastic search using a lot of memory, GC thrashing

**URL:** <https://discuss.elastic.co/t/elastic-search-using-a-lot-of-memory-gc-thrashing/48695>\
**Category:** Elasticsearch\
**Created:** [April 28, 2016, 2:52pm UTC](https://discuss.elastic.co/t/elastic-search-using-a-lot-of-memory-gc-thrashing/48695 "2016-04-28T14:52:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeteyPabPro](https://avatars.discourse-cdn.com/v4/letter/p/eb9ed0/32.png) [@PeteyPabPro](https://discuss.elastic.co/u/PeteyPabPro)\
**Post date:** [April 28, 2016, 2:52pm UTC](https://discuss.elastic.co/t/elastic-search-using-a-lot-of-memory-gc-thrashing/48695/1 "2016-04-28T14:52:56Z")

</div>

Hi,

My ES instance is using 97% of its heap, and is thus garbage collecting almost constantly, and preventing any requests from being successful. Thing is, I can't figure out what is eating up all the memory. There is no field\_data usage at all.

Here are my [node stats](https://gist.github.com/anonymous/5e5a47a3f5476f61e2b30464bd96ccf7)

Please let me know if I can provide any more information. Any help would be appreciated. Thanks!

EDIT: Here is the result of the leak suspects report run on the Elasticsearch heap. It appears to be a memory leak related to groovy scripting. Should I open an issue on github? Or is it possibly something I'm doing wrong?

 ![](https://us1.discourse-cdn.com/elastic/original/2X/0/0dfac864e3b3ad785221b7b5ee07229240d8d0c2.png)

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [May 2, 2016, 11:46am UTC](https://discuss.elastic.co/t/elastic-search-using-a-lot-of-memory-gc-thrashing/48695/2 "2016-05-02T11:46:10Z")

</div>

Hi,

thanks for your analysis! You don't write which version of Elasticsearch you use but it is possible that we fixed the problem in the meantime. So, I suggest that you try to upgrade to the latest possible version first on a test instance and see if the problem persists.

In case it persists, it would be great if you could strip down your scenario so we can reproduce it and then create a ticket on Github.

Daniel

---

<div class="post-metadata">

**Author:** ![PeteyPabPro](https://avatars.discourse-cdn.com/v4/letter/p/eb9ed0/32.png) [@PeteyPabPro](https://discuss.elastic.co/u/PeteyPabPro)\
**Post date:** [May 2, 2016, 1:01pm UTC](https://discuss.elastic.co/t/elastic-search-using-a-lot-of-memory-gc-thrashing/48695/3 "2016-05-02T13:01:41Z")

</div>

Hi Daniel,

Sorry, I'm using 2.3.1. I actually did wind up already creating a [ticket](https://github.com/elastic/elasticsearch/issues/18079#issuecomment-216169797) on Github, to which Yannick responded. Apparently there is a well known Groovy memory leak that is causing this. The best solution seems to be to use native Java scripts rather than Groovy, or at least set `Dgroovy.use.classvalue=true` to revert back to older Groovy behavior (which has problems of its own, but may work here).

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [May 2, 2016, 1:06pm UTC](https://discuss.elastic.co/t/elastic-search-using-a-lot-of-memory-gc-thrashing/48695/4 "2016-05-02T13:06:09Z")

</div>

Hi,

ah, I recall the ticket now. Thanks for posting the link here.

Daniel

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:54pm UTC](https://discuss.elastic.co/t/elastic-search-using-a-lot-of-memory-gc-thrashing/48695/5 "2017-07-05T22:54:41Z")

</div>


