jenkinsci / rubymetrics-plugin

Ruby metric reports for Jenkins. Rcov, Rails stats, Rails notes and Flog.
https://plugins.jenkins.io/rubyMetrics/
25 stars 28 forks source link

Prevent char[] leaks from gobbling heap #13

Closed md5 closed 10 years ago

md5 commented 10 years ago

We've had some Jenkins crashes lately caused by OOME. After enabling heap dumps, I saw that a large proportion of the retained heap was large HTML strings attached to org.htmlparser.* classes. I spent quite some time today trying to track down where the references were coming from without success, so this is a blind fix that ensures that all Strings copied into the Rcov*Result objects have properly sized backing arrays.

If you aren't comfortable applying this patch, I can try to spend some more time understanding exactly how these strings are being retained.

cloudbees-pull-request-builder commented 10 years ago

plugins » rubymetrics-plugin #1 SUCCESS This pull request looks good

jenkinsadmin commented 10 years ago

Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests

md5 commented 10 years ago

Closing this PR for the moment. I did a better analysis of the heap dump and realized that these leaked Strings are only a small part of the problem. I'm going to submit another PR that changes the sourceCode field on RcovFileResult to be a weak reference and to be lazily loaded. That should address the bulk of the actual heap usage issues.