From time to time, we get a report of out of memory problems in Hudson. It’s frequent enough that we have a dedicated Wiki page that talks about how to obtain information to help devs work on the problem.

So the latest thread from David Woon was assumed to be one of those ordinary trouble-shooting sessions, but thanks to Gustaf Lundh, it turned out to be a very interesting exercise.

What we discovered was that the profiler I was using (Your Kit Profiler), was basically eliminating all the weak/soft references from the picture entirely. If we are looking for leaks, this was the right thing, as those references will be cleared before VM chokes with OutOfMemoryError. But because of this elimination, I was completely blind to the wasteful memory usage in Jelly, which are only reachable via soft references.

So I used Eclipse Memory Analyzer and YJP side by side to look into Jelly’s memory usage, and based on that insight, I was able to substantially improve the memory usage and speed of Jelly.

I monitor my production Hudson deployment with VisualGC, and the result was quite noticable. And I hope you’ll notice that the response from Hudson is also snappier.

All these changes are a part of the latest 1.346 release.


Editor’s Note: Kohsuke Kawaguchi a senior engineer at Oracle (formerly Sun) and is the founder and author of the Hudson project. To learn more about Kohsuke, you can follow him on Twitter or subscribe to his blog.

About the Author
R. Tyler Croy

R. Tyler Croy has been part of the Jenkins project for the past seven years. While avoiding contributing any Java code, Tyler is involved in many of the other aspects of the project which keep it running, such as this website, infrastructure, governance, etc.