Skip to content

Add preferred max heap size setting to settings, and autodetect a good value by default #274

Open
@ctrueden

Description

@ctrueden

The JVM's default max heap varies by OpenJDK version, but is typically rather small compared to the size of memory on a computer. For example, I ran out of memory trying to perform a filter.gauss op on a 1G dataset. After increasing my max heap to 16G by adding -Xmx16g to the additional JVM args area, I was able to perform the operation.

But users will not know to do this, especially Python users who don't know Java. Fiji tries to be kind and autoset the max heap to 3/4 of your physical RAM by default, and I think napari-imagej should do the same. I also think the settings dialog should expose an option directly to control max memory, rather than instructing users in the documentation (which many people don't read, of course) to add the arcane -Xmx... flag to extra JVM args.

Detecting physical memory size in Python is simple with psutil:

import psutil    
memory_mb = psutil.virtual_memory().total / 1024**2

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions