# Memory dump question

**URL:** https://discuss.elastic.co/t/memory-dump-question/39149
**Category:** Elasticsearch
**Created:** [January 13, 2016, 6:46pm UTC](https://discuss.elastic.co/t/memory-dump-question/39149 "2016-01-13T18:46:18Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![jchen](https://avatars.discourse-cdn.com/v4/letter/j/3ec8ea/32.png) [@jchen](https://discuss.elastic.co/u/jchen)
#### Post date: [January 13, 2016, 6:46pm UTC](https://discuss.elastic.co/t/memory-dump-question/39149/1 "2016-01-13T18:46:18Z")

</div>

We are currently in the process of building out a new Elasticsearch cluster, with server nodes of 64GB of memory, of which 62GB are dedicated to Elasticsearch process. My question is, we noticed that by default, the java process is set to "-XX:+HeapDumpOnOutOfMemoryError". I assume that this would mean that if an out-of-memory error should occur, it will dump a 31G memory dump file do the default location? If that is the case, is it recommended to leave it on?

---

<div class="post-metadata">

### Author: ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)
#### Post date: [January 14, 2016, 4:49am UTC](https://discuss.elastic.co/t/memory-dump-question/39149/2 "2016-01-14T04:49:28Z")

</div>

> [@jchen](#):
>
> I assume that this would mean that if an out-of-memory error should occur, it will dump a 31G memory dump file do the default location?

Yes.

> [@jchen](#):
>
> If that is the case, is it recommended to leave it on?

It depends, do you want to be able to debug an `OutOfMemoryError`? Note that you can add `"-XX:HeapDumpPath=/path/to/heapdump/heapdump.hprof"` to `JAVA_OPTS` to specify the location.

---

<div class="post-metadata">

### Author: ![jchen](https://avatars.discourse-cdn.com/v4/letter/j/3ec8ea/32.png) [@jchen](https://discuss.elastic.co/u/jchen)
#### Post date: [February 2, 2016, 12:05am UTC](https://discuss.elastic.co/t/memory-dump-question/39149/3 "2016-02-02T00:05:40Z")

</div>

If we want to just disable this, what would be the correct way to?

---

<div class="post-metadata">

### Author: ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)
#### Post date: [February 2, 2016, 2:31am UTC](https://discuss.elastic.co/t/memory-dump-question/39149/4 "2016-02-02T02:31:49Z")

</div>

Comment out

```auto
JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError"

```

in `elasticsearch.in.sh`. I advise _very_ strongly against this. If you're running into situations where having a heap dump is a problem, then all you're doing is preventing the production of useful information that can be used to debug why you're running into `OutOfMemoryError`s. If you're not running into situations where having a heap dump is a problem, then all you're doing, should the need ever arise, is preventing the production of useful information that can be used to debug an unexpected `OutOfMemoryError`.

That is, the solution to the problem of heap dumps filling up disk space is not to turn them off, it's to figure out why the heap is dumping in the first place and the heap dumps will help you figure that out.

> [@jchen](#):
>
> If that is the case, is it recommended to leave it on?

So, returning to this question, the answer is yes.

---

<div class="post-metadata">

### Author: ![yodog](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yodog/32/4822_2.png) [@yodog](https://discuss.elastic.co/u/yodog)
#### Post date: [February 17, 2016, 12:39pm UTC](https://discuss.elastic.co/t/memory-dump-question/39149/5 "2016-02-17T12:39:57Z")

</div>

will the `JAVA_OPTS` line remain commented even after i update logstash?

or i will have to comment it again, after every update?

---

<div class="post-metadata">

### Author: ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)
#### Post date: [February 17, 2016, 4:37pm UTC](https://discuss.elastic.co/t/memory-dump-question/39149/6 "2016-02-17T16:37:15Z")

</div>

> [@yodog](#):
>
> will the JAVA\_OPTS line remain commented even after i update logstash?
> 
> or i will have to comment it again, after every update?

It's not easy to give a definitive answer to this question because there are many varied ways of installing and they don't all do exactly the same thing. The simplest way to get a definitive answer to your question for your setup is to just try it out.

But again, I strongly advise against disabling this flag. If you're having an issue with heap dumps filling up disk space, the root problem is not that your disk is being filled with heap dumps, that is just a symptom of the real problems. And heap dumps are one thing that you need to actually address one of the real problems.

---

<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:15pm UTC](https://discuss.elastic.co/t/memory-dump-question/39149/7 "2017-07-05T23:15:39Z")

</div>


