# Java Heap Dump parameter not generating dumps in specified path and app crashes due to out of memory

**URL:** <https://community.fly.io/t/java-heap-dump-parameter-not-generating-dumps-in-specified-path-and-app-crashes-due-to-out-of-memory/10884>\
**Category:** Questions / Help\
**Created:** [February 20, 2023, 7:43pm UTC](https://community.fly.io/t/java-heap-dump-parameter-not-generating-dumps-in-specified-path-and-app-crashes-due-to-out-of-memory/10884 "2023-02-20T19:43:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ertu](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/ertu/32/9655_2.png) [@ertu](https://community.fly.io/u/ertu)\
**Post date:** [February 20, 2023, 7:43pm UTC](https://community.fly.io/t/java-heap-dump-parameter-not-generating-dumps-in-specified-path-and-app-crashes-due-to-out-of-memory/10884/1 "2023-02-20T19:43:39Z")

</div>

I am using the Java Out-of-Memory heap dump parameter (`-XX:+HeapDumpOnOutOfMemoryError`) to help diagnose issues with my application crashing due to out of memory errors. However, I am having trouble finding the heap dumps in the path that I specified (`-XX:HeapDumpPath=/my-app/dumps`).

I have verified that the parameter is being passed correctly. However, when my application crashes, no heap dumps are generated in the specified path.

This is a problem for me because my app crashes all the time due to out of memory errors, and I need to analyze the heap dumps to understand the root cause of the issue.

If anyone has any suggestions on how I can troubleshoot this problem, I would greatly appreciate your input.

---

<div class="post-metadata">

**Author:** ![ignoramous](https://avatars.discourse-cdn.com/v4/letter/i/a9adbd/32.png) [@ignoramous](https://community.fly.io/u/ignoramous)\
**Post date:** [February 20, 2023, 10:10pm UTC](https://community.fly.io/t/java-heap-dump-parameter-not-generating-dumps-in-specified-path-and-app-crashes-due-to-out-of-memory/10884/2 "2023-02-20T22:10:56Z")

</div>

I don’t think the JVM can intervene when it is the Kernel that OOMs your app?

Each time Fly boots up an app, it does so on a clean volume, so persisting crash dumps on what’s essentially ephemeral isn’t going to help.

Try allocating and mounting a persistent volume onto your app ([ref](https://community.fly.io/t/preview-persistent-disks-for-fly-apps/332), [docs](https://fly.io/docs/reference/volumes/)) and see if heap dumps survive there.

Also, if it is possible to write out heap dumps to stdout, then you can grab the logs via `fly-log-shipper` or `fly-log-local` ([ref](https://community.fly.io/t/streaming-app-logs-from-one-fly-app-to-another-for-analysis/6676/2)).

---

<div class="post-metadata">

**Author:** ![ertu](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/ertu/32/9655_2.png) [@ertu](https://community.fly.io/u/ertu)\
**Post date:** [February 20, 2023, 10:13pm UTC](https://community.fly.io/t/java-heap-dump-parameter-not-generating-dumps-in-specified-path-and-app-crashes-due-to-out-of-memory/10884/3 "2023-02-20T22:13:33Z")

</div>

Thanks! I’ll check the docs you’ve shared
