nashorn memory footprint with large amount of compiled scripts

r houtman rl_houtman at yahoo.com
Tue Feb 23 14:40:17 UTC 2016


Dear Devs,
 We’re running Nashorn on Java 1.8u45, and we’refacing issues because we require considerable scripts to run side by side. We load about 2000 different javascripts andcompile them. Before starting the scripts the used JVM heap memoryis 177 MB and after compilation 468 MB. This is an avarage of 145 KB/script. Why is the memory consumption for a compiledscript so large? Are there settings which could reduce/optimize thememory footprint? Each script has its own memory context.The “io” variable is an java-object stored in thememory context.Every script is executed every 100 msec withits own (same) memory context.An average script looks like this: ------------------------------------------------------------ var iPVar0 =io.input(1) == 1 ? Number(io.input(0)) : io.input(0);var iPVar1 =Number(io.input(2));var iPVar2 =io.input(4) == 1 ? Number(io.input(3)) : io.input(3);var iPVar3 =Number(io.input(5));var oPVar1_B;var oPVar2_TP; if(iPVar0 =="AOF"){  io.output(0,io.input(6));  oPVar2_TP = 0;  oPVar1_B = 0;}else if(iPVar1 == 9 &&iPVar2 != 34){ io.output(0,io.input(7));  oPVar2_TP = 1;  if(iPVar3 ==0){   oPVar1_B = 1;  }else{   oPVar1_B = 0;  }}else if(iPVar3 == 0){ io.output(0,io.input(8));  oPVar2_TP = 0;  oPVar1_B = 1;}else{ io.output(0,io.input(9));  oPVar1_B = 0;  oPVar2_TP = 0;} io.output(1,oPVar1_B);io.output(2,oPVar2_TP);---------------------------------------------------Kind regards
  


More information about the nashorn-dev mailing list