Garbage collector headless ImageJ

Hi !

I would like to use the garbage collector within my ImageJ macro.
I’m currently using these commands:
run(“Collect Garbage”);
But I noticed that the RAM usage increased much faster in the headless mode as compared to GUI. I wonder if these commands are not taken into account.
I’d rather use the garbage collector at specific moments of the analysis (eg. after closing intermediary outputs …) instead of defining a memory threshold, but is it really necessary ?
I also tried these options (as advised in this webpage)
[WARNING] Ignoring invalid argument: -Xms10000m
[WARNING] Ignoring invalid argument: -Xmx4000m
[WARNING] Ignoring invalid argument: -Xincgc
I’m currently using an old version (ImageJ 2017) on linux so I hope to find a solution…

Thank you in advance!