Hi Michel,

Thanks for the quick and easy github repository to reproduce this.

Looking at the code running with jvisualvm I can't see any excessive memory usage. Both with JDK 8u60 and 9 heap usage is around 150 MB.

The fact that Java reserves a lot of memory on Linux is a well-known fact. It's not related to Nashorn, but rather to how Java interacts with the Linux memory system. It is a bit annoying, but usually it's not a problem and does not reflect Java heap usage.

Hannes


Am 2015-10-05 um 20:02 schrieb Michel Krämer:
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

Reply via email to