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

Hannes Wallnoefer hannes.wallnoefer at oracle.com
Fri Apr 26 08:14:17 PDT 2013


I found something I didn't like: ScriptFunction.getPrototype() was made 
abstract, but the prototype field was still in ScriptFunction and 
protected. I now moved everything to ScriptFunctionImpl and made the 
prototype field private.

New webrev: http://cr.openjdk.java.net/~hannesw/8006559/webrev.01/

Hannes

Am 2013-04-26 16:42, schrieb Jim Laskey (Oracle):
> +1
>
> On 2013-04-26, at 11:04 AM, Hannes Wallnoefer <hannes.wallnoefer at oracle.com> 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