# Huge memory leaks caused by ElasticSearch

**URL:** <https://discuss.elastic.co/t/huge-memory-leaks-caused-by-elasticsearch/35353>\
**Category:** Elasticsearch\
**Created:** [November 23, 2015, 7:34pm UTC](https://discuss.elastic.co/t/huge-memory-leaks-caused-by-elasticsearch/35353 "2015-11-23T19:34:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Hintzke](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@Matt\_Hintzke](https://discuss.elastic.co/u/Matt_Hintzke)\
**Post date:** [November 23, 2015, 7:34pm UTC](https://discuss.elastic.co/t/huge-memory-leaks-caused-by-elasticsearch/35353/1 "2015-11-23T19:34:29Z")

</div>

I have recently taken on the task of managing our existing ES index and in doing so had to alter the index in a way to allow sorting on certain fields. Ever since my updates to the index mapping and an increase in total traffic I/O we have been seeing more and more memory leaks where we could go from 3GB/28GB to 27GB/28GB in less than an hour even though a top command reveals ES only taking up 14% of the total memory.

Here is our configuration:

1 node w/ 28GB RAM on Azure VM (Ubuntu)  
1 Index w/ 83.4GB of data

What other information would you like to see to help debug? Thanks!

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 24, 2015, 1:14am UTC](https://discuss.elastic.co/t/huge-memory-leaks-caused-by-elasticsearch/35353/2 "2015-11-24T01:14:18Z")

</div>

Are you talking about heap or system memory?

---

<div class="post-metadata">

**Author:** ![Matt\_Hintzke](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@Matt\_Hintzke](https://discuss.elastic.co/u/Matt_Hintzke)\
**Post date:** [November 24, 2015, 5:54am UTC](https://discuss.elastic.co/t/huge-memory-leaks-caused-by-elasticsearch/35353/3 "2015-11-24T05:54:48Z")

</div>

System Memory (via 'top' command'), is there a way for me to query the actual heap size in real time?

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [November 24, 2015, 7:53pm UTC](https://discuss.elastic.co/t/huge-memory-leaks-caused-by-elasticsearch/35353/4 "2015-11-24T19:53:18Z")

</div>

> [@Matt\_Hintzke](#):
>
> System Memory (via 'top' command'), is there a way for me to query the actual heap size in real time?

Top tends to display memory used for disk caching. Have a look at `free`. The top line includes the caching and the second line is memory used by running programs. Both are in use - elasticsearch relies on the disk cache to make its job fast. But the cache is only cleared when full so its fairly normal to see it fill up and stay full.

You can see heap size in realtime with `jstat` or the [jvm node stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-stats.html) from elasticsearch. Keep in mind that heap is pretty similar to the cache - its allocated over time and only freed when it gets close to full. So the instantaneous heap values aren't all that interesting. You really need to graph heap and look at the space between the GCs.

All and all, unless you are seeing a problem its not worth getting worked up over.

---

<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, 11:36pm UTC](https://discuss.elastic.co/t/huge-memory-leaks-caused-by-elasticsearch/35353/5 "2017-07-05T23:36:13Z")

</div>


