# Concerns about ES Unable to lock JVM Memory: error=12,reason=Cannot allocate memory

**URL:** <https://discuss.elastic.co/t/concerns-about-es-unable-to-lock-jvm-memory-error-12-reason-cannot-allocate-memory/51094>\
**Category:** Elasticsearch\
**Created:** [May 26, 2016, 8:33pm UTC](https://discuss.elastic.co/t/concerns-about-es-unable-to-lock-jvm-memory-error-12-reason-cannot-allocate-memory/51094 "2016-05-26T20:33:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Montgomery](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@David\_Montgomery](https://discuss.elastic.co/u/David_Montgomery)\
**Post date:** [May 26, 2016, 8:33pm UTC](https://discuss.elastic.co/t/concerns-about-es-unable-to-lock-jvm-memory-error-12-reason-cannot-allocate-memory/51094/1 "2016-05-26T20:33:50Z")

</div>

Hi,

What is the deal with ES and memory? I am usig using 2.1.3.

I set heap\_size of half of ram

I set the below

```
echo 'elasticsearch soft memlock unlimited' | tee -a /etc/security/limits.conf
echo 'elasticsearch hard memlock unlimited' | tee -a /etc/security/limits.conf
swapoff -a

```

ES.....how does one resovle on a 4 gig ram server?

```
[2016-05-26 20:27:58,638][WARN][bootstrap] Unable to lock JVM Memory: error=12,reason=Cannot allocate memory
[2016-05-26 20:27:58,638][WARN][bootstrap] This can result in part of the JVM being swapped out.
[2016-05-26 20:27:58,638][WARN][bootstrap] Increase RLIMIT_MEMLOCK, soft limit: 65536, hard limit: 65536
[2016-05-26 20:27:58,638][WARN][bootstrap] These can be adjusted by modifying /etc/security/limits.conf, for example:
        # allow user 'elasticsearch' mlockall
        elasticsearch soft memlock unlimited
        elasticsearch hard memlock unlimited
[2016-05-26 20:27:58,638][WARN][bootstrap] If you are logged in interactively, you will have to re-login for the new limits to take effect.
[2016-05-26 20:27:59,950][INFO][node] [James Dr. Power] version[2.3.1], pid[24379], build[bd98092/2016-04-04T12:25:05Z]
[2016-05-26 20:27:59,950][INFO][node] [James Dr. Power] initializing ...
[2016-05-26 20:28:02,408][INFO][plugins] [James Dr. Power] modules [lang-groovy, reindex, lang-expression], plugins [marvel-agent, license], sites []
[2016-05-26 20:28:02,494][INFO][env] [James Dr. Power] using [1] data paths, mounts [[/data (/dev/xvdf)]], net usable_space [0b], net total_space [9.7gb], spins?$
[2016-05-26 20:28:02,507][INFO][env] [James Dr. Power] heap size [1007.3mb], compressed ordinary object pointers [true]
[2016-05-26 20:28:02,507][WARN][env] [James Dr. Power] max file descriptors [65535] for elasticsearch process likely too low, consider increasing to at least [65$
[2016-05-26 20:28:11,555][INFO][node] [James Dr. Power] initialized
[2016-05-26 20:28:11,555][INFO][node] [James Dr. Power] starting ...
[2016-05-26 20:28:11,832][INFO][transport] [James Dr. Power] publish_address {172.31.28.230:9300}, bound_addresses {[::]:9300}
[2016-05-26 20:28:11,848][INFO][discovery] [James Dr. Power] elasticsearchzenawssgdevelopmentlogging/xSWXNMKCRS61xoBNZ7C3ew
[2016-05-26 20:28:14,885][INFO][cluster.service] [James Dr. Power] new_master {James Dr. Power}{xSWXNMKCRS61xoBNZ7C3ew}{172.31.28.230}{172.31.28.230:9300}, reason: zen-disco$
[2016-05-26 20:28:14,942][INFO][http] [James Dr. Power] publish_address {172.31.28.230:9200}, bound_addresses {[::]:9200}
[2016-05-26 20:28:14,942][INFO][node] [James Dr. Power] started
[2016-05-26 20:28:19,060][INFO][license.plugin.core] [James Dr. Power] license [06f10d9f-43a1-4587-ba5c-9fac2f344273] - expired
[2016-05-26 20:28:19,096][ERROR][license.plugin.core] [James Dr. Power]
#
# LICENSE EXPIRED ON [Monday, April 11, 2016]. IF YOU HAVE A NEW LICENSE, PLEASE
# UPDATE IT. OTHERWISE, PLEASE REACH OUT TO YOUR SUPPORT CONTACT.
#
# COMMERCIAL PLUGINS OPERATING WITH REDUCED FUNCTIONALITY
# - marvel
# - The agent will stop collecting cluster and indices metrics
# - The agent will stop to automatically clean up indices older than [marvel.history.duration]
[2016-05-26 20:28:19,995][WARN][gateway] [James Dr. Power] [_global]: failed to write global state
java.io.IOException: No space left on device
        at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
        at sun.nio.ch.FileDispatcherImpl.write(FileDispatcherImpl.java:60)
        at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
        at sun.nio.ch.IOUtil.write(IOUtil.java:65)
        at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:205)
        at java.nio.channels.Channels.writeFullyImpl(Channels.java:78)
```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 27, 2016, 7:10am UTC](https://discuss.elastic.co/t/concerns-about-es-unable-to-lock-jvm-memory-error-12-reason-cannot-allocate-memory/51094/2 "2016-05-27T07:10:25Z")

</div>

I reformat a bit your post. Please use `</>` button when posting.

You have a more major issue than the RAM I believe: `No space left on device`.

About your memory settings issue, I'm not qualified to answer but I'd just like to share this link in case it helps: [https://www.elastic.co/guide/en/elasticsearch/reference/2.3/setup-service.html#\_linux](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/setup-service.html#_linux)

---

<div class="post-metadata">

**Author:** ![ZillaG](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zillag/32/10505_2.png) [@ZillaG](https://discuss.elastic.co/u/ZillaG)\
**Post date:** [October 4, 2016, 2:31pm UTC](https://discuss.elastic.co/t/concerns-about-es-unable-to-lock-jvm-memory-error-12-reason-cannot-allocate-memory/51094/3 "2016-10-04T14:31:57Z")

</div>

Where do I set these values described [here](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/setup-service.html#_linux), in the elasticsearch.yml file?

---

<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:15pm UTC](https://discuss.elastic.co/t/concerns-about-es-unable-to-lock-jvm-memory-error-12-reason-cannot-allocate-memory/51094/4 "2017-07-05T22:15:06Z")

</div>


