# Locked memory exceeded

**URL:** <https://discuss.elastic.co/t/locked-memory-exceeded/26117>\
**Category:** Elasticsearch\
**Created:** [July 22, 2015, 10:53pm UTC](https://discuss.elastic.co/t/locked-memory-exceeded/26117 "2015-07-22T22:53:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomr/32/48260_2.png) [@tomr](https://discuss.elastic.co/u/tomr)\
**Post date:** [July 22, 2015, 10:53pm UTC](https://discuss.elastic.co/t/locked-memory-exceeded/26117/1 "2015-07-22T22:53:49Z")

</div>

Curious how this is happening:

`USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND 105 27647 124 93.5 409500956 15397724 ? SLl 21:52 72:26 /usr/lib/jvm/java-7-oracle/bin/java -Xms10g -Xmx10g -Xss256k <snip>`

I've got 20GB of RAM, ES\_HEAP\_SIZE set to 10g and using mlockall. So how could ES be using 15GB?

---

<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:** [July 23, 2015, 12:19am UTC](https://discuss.elastic.co/t/locked-memory-exceeded/26117/2 "2015-07-23T00:19:55Z")

</div>

That's not heap, that's virtual memory.

---

<div class="post-metadata">

**Author:** ![tomr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomr/32/48260_2.png) [@tomr](https://discuss.elastic.co/u/tomr)\
**Post date:** [July 23, 2015, 12:23am UTC](https://discuss.elastic.co/t/locked-memory-exceeded/26117/3 "2015-07-23T00:23:37Z")

</div>

So it's normal / expected? I've been using ES in a few places for a few months now under pretty heavy use and haven't seen it go over the allocated 50% til now. The column I'm looking at is RSS btw.

---

<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:** [July 23, 2015, 6:32am UTC](https://discuss.elastic.co/t/locked-memory-exceeded/26117/4 "2015-07-23T06:32:38Z")

</div>

Yeah don't worry too much, it's just the OS caching file that ES uses. This is why we recommend giving 50% of system RAM to it, it allows the OS to do this to make things _fast_.

---

<div class="post-metadata">

**Author:** ![tomr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomr/32/48260_2.png) [@tomr](https://discuss.elastic.co/u/tomr)\
**Post date:** [July 23, 2015, 12:35pm UTC](https://discuss.elastic.co/t/locked-memory-exceeded/26117/5 "2015-07-23T12:35:59Z")

</div>

So maybe I've misunderstood. I thought the main reason to keep heap size under ~50% of available RAM was because the OS filesystem cache only uses **available** ie free, unused memory for the filesystem cache, and further that the OS filesystem cache will never ever show up as part of the memory used by the ES java process.

---

<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:59pm UTC](https://discuss.elastic.co/t/locked-memory-exceeded/26117/6 "2017-07-05T23:59:30Z")

</div>


