Reducing Garbage Generated by URLClassLoader

Scott Palmer swpalmer at
Mon Dec 5 17:27:12 UTC 2016

> On Dec 5, 2016, at 1:31 AM, Max Kanat-Alexander <mkanat at> wrote:
> Yeah, I have implemented a fast-path byte-only ZipCoder in a customized JDK
> and it makes a big difference for allocations in long classpaths.

I expected to see an improvement, but haven’t made any attempt at solving the problem yet.  I was just gauging how much interest there was in such a change.  It is nice to see that some work has already been done.  Do you have numbers?



> The basic
> code to do just that isn't very complex. I could possibly dig that up and
> upstream it if there's interest. My recollection is that my solution isn't
> the cleanest, but it doesn't regress the "needs encoding" path.
> It also is possible to optimize URLClassLoader itself to do a better job of
> caching zip entries, which significantly reduces the String allocation load
> if you're doing a lot of lookups on the classpath. I have also implemented
> something like this, but it's hard to get right and my changes aren't in a
> state where they could be easily upstreamed.
> -Max

More information about the core-libs-dev mailing list