ImageJ launcher and available memory detection


#1

In ImageJ FX, I use an java based launched to detect the amount of memory that the user has on his computer. Of course, the method differs from OS to OS but it ensures that the user always have enough memory to open big image. Since I would like to incorporate ImageJ FX more into the ImageJ platform, I would like to offer this option for ImageJ. But the launcher is quite different. Is there any documentation specifying how the launcher works exactly ? I went through the code and I can see that it parses some parameters like “–mem” so the goal would be that if it’s not specified, it would check the available RAM of the computer and start the JVM with this amount of RAM, avoiding later on any out-of-memory error.

Cheers,

Cyril


#2

Hi @cmongis,

The currently used heuristic is implemented in ImageJ.c#L1772-L1791. The passed Xmx option is calculated as 75% of the available RAM (all the RAM, not just the “free” RAM).

Best,
Stefan