Review request for JDK-8006559: Octane:pdfjs leaks memory, runs slower iteration to iteration

A. Sundararajan sundararajan.athijegannathan at oracle.com
Fri Apr 26 07:25:52 PDT 2013


+1

-Sundar

On Friday 26 April 2013 07:34 PM, Hannes Wallnoefer wrote:
> Please review JDK-8006559: Octane:pdfjs leaks memory, runs slower 
> iteration to iteration
>
> http://cr.openjdk.java.net/~hannesw/8006559/
>
> What happened in pdfjs was that each new function instance created a 
> prototype object that was registered as property listener with 
> Object.prototype. Although we were using WeakReference for this the 
> references themselves where only cleared when a property on 
> Object.prototype was added, modified, or deleted, which never happens 
> with pdfjs.
>
> I tried a few solutions and settled on using WeakHashMap because it 
> allows for efficient removal both through GC and manual removal. This 
> makes it impossible for us to support the listenersDead counter so I 
> removed it. I also made instantiation of the prototype property of 
> script functions lazy.
>
> Pdfjs score now is > 3000 on my laptop and stable (before it peaked at 
> 1300 before starting to dive).
>
> Hannes



More information about the nashorn-dev mailing list