fmarques.org

Discovering jemalloc and debugging native Java memory leaks

· fred

I’ve joined ThoughtWorks last August and I’ve been working with the tech team on everything related to infrastructure automation, code deployment and all things “DevOps” for GOV.UK Verify (part of the Government Digital Services). The last few months were very rewarding to me as I got exposed to a lot of different technologies, although I do tend to work a lot with Puppet most of the time and I don’t get the chance to look at other things “from the other side”. Working with the dev team on a Java memory leak issue was a great way to dig into something where I was already familiar with but I had the chance to understand a little bit more about JVM memory allocation, Linux kernel memory management and discovering great tools like jemalloc and the excellent jeprof profiler. We lost a long time playing the guess game and using the wrong tools before we found this excellent post by Evan Jones from Twitter. This led us to the discovery of jemalloc and I highly recommend having a look at it. It’s really worth it. We (Ozz) also wrote our story on GOV.UK Verify and we hope it can help others when dealing with similar native Java memory leaks.