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.
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