Running octane pdfjs with optimistic typing it is visible how occupied OldSpace is increasing in time. It causes performance degradation and OutOfMemoryError at the end.
Used heap increases slowly - required long execution: e.g. with 512M heapsize it requires up to 200-300 iterations before OOM:
java -Xmx512m -Xms512m jdk.nashorn.tools.Shell test/script/basic/run-octane.js --optimistic-types=true -scripting -- pdfjs --runtime nashorn --verbose --iterations 300
PS There is no memory leak when optimistic typing turned off.