Getting head dumps on OutOfMemoryException

This is one of these notes to self that I keep writing on the blog…

Add the following java options when launching an application (or application server) to get a dump if the application throws an OutOfMemoryException

-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/where/to/write/the/dump

We are using this on out local and development servers at work, and then using Eclipse MAT to diagnose the cause.

So far, it is been a pleasure working with MAT. We are maintaining some legacy web application which occasionally crashes due to OOM, so we took a dump and fed it to MAT.

Despite of my attempts to look at the wrong places (since we got OOM) on a webservice, MAT kept showing me our real memory problem until I understood it. The exception on the webservice was only collateral damage… most of the memory was being used in the tests run before the actual crash.

Now we save more than 2.5Mb on each http session, since it turned out that the application was caching too much, too many times (on every session, instead of sharing the data at the application level).

I’m happy 🙂

Advertisements

  1. Sometimes it’s hard to track OOM issues down, but this Eclipse MAT seems to do a good job. I should keep it in mind.





  • My Open Source

  • Twitter Updates

    • @micho Infovia anyone? 2 hours ago
    • After days in Elixir, I write Ruby like: class Scoped.Thing do def baz do do_something() end end And wonder why it doesn’t parse 7 hours ago
    • RT @islomar: A piece of advice for anyone applying for a job: clearly transmit your MOTIVATIONS, GOALS and WHYS, not just a bunch of topics… 11 hours ago
    • RT @realntl: @wycats We want to say "sorry mgmt, we made a mess and need time to rewrite" but "the lang/framework sucks and we need to migr… 21 hours ago
    • @MarkVillacampa Al menos con todo esto, alguna gente aprenderá a actualizarse y por quĂ©. Sobre todo la oposiciĂłn! 21 hours ago
  • Enter your email address to follow this blog and receive notifications of new posts by email.

    Join 9 other followers

  • Flickr Photos


%d bloggers like this: