# Problem with heap size

**URL:** <https://discuss.elastic.co/t/problem-with-heap-size/233739>\
**Category:** Elasticsearch\
**Created:** [May 21, 2020, 12:58pm UTC](https://discuss.elastic.co/t/problem-with-heap-size/233739 "2020-05-21T12:58:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Intissar\_Ayadi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/intissar_ayadi/32/59264_2.png) [@Intissar\_Ayadi](https://discuss.elastic.co/u/Intissar_Ayadi)\
**Post date:** [May 21, 2020, 12:58pm UTC](https://discuss.elastic.co/t/problem-with-heap-size/233739/1 "2020-05-21T12:58:41Z")

</div>

I have a machine running elasticsearch 7.X as a service, wich have 64GO of RAM available,

When setting the heap size of elasticsearch( `Xmx` and `Xms` 50% of my physical RAM) , it cannot accept and elasticsearch failed to start.

Another problem, when i set the heap size to x value, for example 20GO ,elasticsearch start withount problem but when i rebbot the machine or stop the service elasticsearch failed to start with the last heap size, i shoud decrease the value to start it .

How can I fix this error or what is the problem plz ?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 22, 2020, 3:57am UTC](https://discuss.elastic.co/t/problem-with-heap-size/233739/2 "2020-05-22T03:57:04Z")

</div>

The recommendation is generally to set the heap to 50% of RAM or around 30GB (to make sure you make use of compressed pointers). Without seeing error messages or logs it is hard to know why it is failing to start up.

---

<div class="post-metadata">

**Author:** ![Intissar\_Ayadi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/intissar_ayadi/32/59264_2.png) [@Intissar\_Ayadi](https://discuss.elastic.co/u/Intissar_Ayadi)\
**Post date:** [May 22, 2020, 10:47am UTC](https://discuss.elastic.co/t/problem-with-heap-size/233739/3 "2020-05-22T10:47:12Z")

</div>

Hello Christian,  
when setting 30GO ,elasticsearch failed to start, bellow log message:

[2020-05-22T10:41:28.760+0000][7131][gc,heap] Heap region size: 8M  
[2020-05-22T10:41:28.760+0000][7131][gc,heap,coops] Heap address: 0x0000000080000000, size: 30720 MB, Compressed Oops mode: Zero based, Oop shift amount: 3  
[2020-05-22T10:41:29.082+0000][7131][gc] Using G1  
[2020-05-22T10:41:29.502+0000][7131][gc] Periodic GC disabled  
[2020-05-22T10:41:29.659+0000][7131][gc,heap,exit] Heap  
[2020-05-22T10:41:29.659+0000][7131][gc,heap,exit] garbage-first heap total 31457280K, used 8192K [0x0000000080000000, 0x0000000800000000)  
[2020-05-22T10:41:29.659+0000][7131][gc,heap,exit] region size 8192K, 2 young (16384K), 0 survivors (0K)  
[2020-05-22T10:41:29.659+0000][7131][gc,heap,exit] Metaspace used 3134K, capacity 4480K, committed 4480K, reserved 1056768K  
[2020-05-22T10:41:29.659+0000][7131][gc,heap,exit] class space used 263K, capacity 384K, committed 384K, reserved 1048576K

---

<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:** [June 19, 2020, 10:47am UTC](https://discuss.elastic.co/t/problem-with-heap-size/233739/4 "2020-06-19T10:47:25Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
