Hi,
We are testing Nashorn usage and we have a big issue on metaspace usage. We 
can’t figure out why metaspace show a sawtooth that correspond to a grow and a 
consequent GC when its limit is reached, suggesting a class loader leak is 
somewhere. The metaspace patter was 1:1 with number of classes like many 
compilation were needed.

The problem seems to be around a loop where we add callable tasks to a thread 
pool to be executed and how to pass parameters to the js function that 
represent the task logic.
We found a solution for the high number of compiled classes using a code like:

var tasks = arrayForTask.map(function(dataForTask, i) {
            return new Callable({
                call: function () {
                    print("task A " + i);
                }
            });
        });

So now classes do now grow as before but the metaspace always grows…
I can’t find any source that clearly explain where the compiled js functions 
are stored (lambda form) into memory, I can understand that compilation is 
needed when nashorn think the js function body changed, like for references to 
different globals and so on.
So in the end should I always expect a metaspace grow controlled by the GC?? 
even if the code has no leak? that seems to be kind of reasonable cause the JIT 
compilation is needed for a dynamic language that has no defined “class” 
structure but I can’t understand if GC should be the only limit to my OOME or 
if a leak is somewhere…
Thanks,
Riccardo.

--
Riccardo Maggi
Manager, Software Development
Hotels.com – An Expedia Inc. Company
Venere Net S.r.l. con socio unico Via della Camilluccia 693, Roma, Italia 
Soggetta a direzione e coordinamento di Hotels.com LP Capitale 1.120.600 (i. 
v.) Sociale Codice Fiscale e P.IVA 05649781001 REA di Roma 910870

Reply via email to