Excessive memory usage

Michel Krämer michel at undercouch.de
Mon Oct 5 18:02:51 UTC 2015


Hi!

I'm currently working on TypeScript support for Vert.x. I'm trying to 
run the TypeScript compiler on Nashorn. It works well, but the process 
uses a lot of memory. I'm wondering if there is a bug in Nashorn or if 
I'm doing something wrong.

I uploaded a small example project demonstrating the issue:
https://github.com/michel-kraemer/nashorn-memory-test

I tested it under Ubuntu 14.04 with JDK 8u60. I run

javac Main.java && java -Xmx256M -cp . Main

and watch the process with top. The resident memory quickly goes up to 1 
GB and after about 20 iterations grows even further to 1.2 GB. After 
about 500 iterations it sometimes even goes up to 1.5 GB where it stays 
until the end of the program. That's 1.3 GB more than I specified with 
-Xmx. I know this is metaspace, but I wonder why Nashorn needs so much 
of it. By the way, even if I do only 1 iteration the process still goes 
up to 400-500 MB.

Any ideas?

Cheers,
Michel


More information about the nashorn-dev mailing list