OutOfMemoryError on bfconvert

Hello everyone!

Environment
macOS 10.14
java version “12.0.2” 2019-07-16
Java™ SE Runtime Environment (build 12.0.2+10)
Java HotSpot™ 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)

Problem
I tried converting a 2.25Gb file to ome.tiff like so:
./bfconvert /path/to/file.czi TEST.ome.tiff

Got the following error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

Tried adding the -Xmx option but it doesn’t get recognized here.

How can more memory be added ?

Thanks in advance!

Setting the BF_MAX_MEM environment variable works well, to 2g or whatever makes sense for your system, see https://docs.openmicroscopy.org/bio-formats/6.2.0/users/comlinetools/#command-line-environment.

Thanks for the answer!

I actually solved it by using this https://stackoverflow.com/questions/880855/increase-the-java-heap-size-permanently.

Is there a difference between the two ?

Do you build pyramids when exporting? If that’s the case check if the memory error is not due to this issue, which will make your image unnecessarily big:


This should be solved in bioformats 6.2.1, as far as I understand.

BF_MAX_MEM is a part of Bio-Formats’ command-line interface and works with older versions of Java. _JAVA_OPTIONS looks to be a newer addition to the JVM and should work moving forward. However, see https://stackoverflow.com/questions/17781405/information-about-java-options about the similar JAVA_TOOL_OPTIONS.

I don’t know what will happen if both are defined, but otherwise, use of either seems fine.

~Josh