"Out of memory, all available memory (247MB) has been used"

fiji
imagej
memory

#21

Note that the java version displayed in Fiji: 1.8.0_172 do not match the one shown in your first post (1.8.0_171). There might be something to understand here.


#22

@NicoKiaru that’s true ! I’ve went and checked what is up with the java versions, and here’s the situation :

  • java 1.8.0_171 is the version I had already installed on my computer prior to installing Fiji
  • java 1.8.0_172 is the version that comes with the Fiji bundle when you download it

I’ve searched in the Java Control Panel and deactivated the 171 version (the one that wasn’t installed with Fiji), and checked that the 172 version (the one installed with Fiji) was activated. It didn’t change anything when I restarted Fiji and retried to open my image file : still the same error message.

@Herbie I had just checked the “Keep multiple undo buffers” to try if it was changing anything with my problem, and it didn’t ! I’ll just uncheck it from now, thanks for the advice :slight_smile:


#23

Out of curiosity, have you tried the opposite ? Just remove temporarily the java folder inside Fiji.app.


#24

Have you tried the simple solution of opening your image as a virtual stack?


#25

@NicoKiaru I have tried the opposite, and pretty much any combination possible : when I remove the 172 version of the Fiji.app folder, ImageJ automatically detects that the 171 version is installed somewhere else on the computer and switches to it (it’s indicated in the status bar), but the problem is still the same.

@rondespain Yes I have, as mentioned before, and it does work, but the problem is the macro I use doesn’t use TIFF Virtual Stack to open the file so it’s not really a viable solution :confused:

Thanks, Erwan

PS: Sorry for the inactivity, I was on a break


#26

Ok, I’m out of ideas…

As a last attempt, can you execute this groovy script on Fiji and post the result here ? Maybe check the output before posting but I think that’s fine.

import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
import java.lang.management.OperatingSystemMXBean;

// System
print("------------ System ---------------\n");
for (key in System.getProperties().keys()) {
	print(key+':'+System.getProperty(key)+'\n');
}
print("Cores : "+Runtime.getRuntime().availableProcessors()+"\n");

// Memory
print("------------ Memory ---------------\n");
print("Heap : "+getHeap()+"\n");
print("Non Heap : "+getNonHeap()+"\n");
print("RT free mem : " + (Runtime.getRuntime().freeMemory()/ (1024.0 * 1024.0))+ " Mb\n");
print("RT total mem : " + (Runtime.getRuntime().totalMemory()/ (1024.0 * 1024.0))+ " Mb\n");
print("RT max mem : " + (Runtime.getRuntime().maxMemory()/ (1024.0 * 1024.0))+ " Mb\n");


String getHeap() {
		MemoryMXBean mem = ManagementFactory.getMemoryMXBean();
		double c = 1.0 / (1024.0 * 1024.0);
		double u = mem.getHeapMemoryUsage().getUsed() * c;
		double m = mem.getHeapMemoryUsage().getMax()  * c;
		double i = mem.getHeapMemoryUsage().getInit() * c;
		return String.format("u=%3.2f m=%3.2f i=%3.2f Mb", u, m, i);
}

String getNonHeap() {
		MemoryMXBean mem = ManagementFactory.getMemoryMXBean();
		double c = 1.0 / (1024.0 * 1024.0);
		double u = mem.getNonHeapMemoryUsage().getUsed() * c;
		double m = mem.getNonHeapMemoryUsage().getMax() * c;
		double i = mem.getNonHeapMemoryUsage().getMax() * c;
		return String.format("u=%3.2f m=%3.2f i=%3.2f Mb", u, m, i);
}

#27

@Erwan I am currently having this same exact problem. I have spent way too long trying to fix it on my own. Have you by chance figured it out?

Also, when did this issue start occurring for you? I do not use imageJ often so I am just getting to fixing it, but this has been an issue since 3 to 4 weeks ago.


#28

@llamaswithhats @Erwan could you please both follow the advice by @NicoKiaru and post the output of the script he posted?


#29

@imagejan @NicoKiaru I very new to imagej so I might be doing this wrong. I am just putting the code that NicoKIaru posted in the File>New>Script tab. I assume this is where I am suppose to be running this. Then I saved the file name as “test.java”

What I am getting in the “Show output” tab:
“Started test.java at Thu May 31 07:48:10 PDT 2018”

Under the “Run” tab:
“Started test.java at Thu May 31 07:52:18 PDT 2018
java.lang.NullPointerException
at org.scijava.minimaven.MavenProject$XMLHandler.endElement(MavenProject.java:1531)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.scijava.minimaven.MavenProject.parse(MavenProject.java:1480)
at org.scijava.minimaven.BuildEnvironment.parse(BuildEnvironment.java:217)
at org.scijava.plugins.scripting.java.JavaEngine.fakePOM(JavaEngine.java:748)
at org.scijava.plugins.scripting.java.JavaEngine.writeTemporaryProject(JavaEngine.java:630)
at org.scijava.plugins.scripting.java.JavaEngine.getMavenProject(JavaEngine.java:530)
at org.scijava.plugins.scripting.java.JavaEngine.access$700(JavaEngine.java:96)
at org.scijava.plugins.scripting.java.JavaEngine$Builder.initialize(JavaEngine.java:405)
at org.scijava.plugins.scripting.java.JavaEngine$Builder.access$100(JavaEngine.java:364)
at org.scijava.plugins.scripting.java.JavaEngine.compile(JavaEngine.java:197)
at org.scijava.plugins.scripting.java.JavaEngine.eval(JavaEngine.java:136)
at org.scijava.script.ScriptModule.run(ScriptModule.java:160)
at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
at org.scijava.thread.DefaultThreadService$3.call(DefaultThreadService.java:238)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
java.lang.IllegalArgumentException: Unknown code type: null
at org.scijava.run.RunService.run(RunService.java:63)
at org.scijava.plugins.scripting.java.JavaEngine.eval(JavaEngine.java:137)
at org.scijava.script.ScriptModule.run(ScriptModule.java:160)
at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
at org.scijava.thread.DefaultThreadService$3.call(DefaultThreadService.java:238)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)”


#30

Hi @llamaswithhats,
no need to save it, just select Language > Groovy, then hit the run button. It’s actually a Groovy script and not a Java script.

Hope that’s clear, let us know!


#31

I have now seen several reports of people who get OutOfMemoryError even though they have allocated (relatively) lots of memory to Java. We see this above as well in @Erwan’s original screen shot of the Fiji window, where it says “18MB of 2048MB” in the status bar. There is definitely something strange/buggy going on with certain systems.

Has anyone affected by this issue tried @NicoKiaru’s advice of running as administrator? Is everyone affected running Windows? Into which directory do you have your Fiji installed? Somewhere in C:\Users\<yourusername>?


#32

HI. I am also working on image J mainly dealing with the Iuumofluroscence mutichannel images and my file size is appx 4 gb each. My images are quite big and its takes time to open. I has suffered from the "out of space issue " after analyzing 5 images of mine. Then based on the suggestion from various forum I increased the space of the memory to 75 GB space and was able to to do the analyis.
However, now I am again suffering from the same issue when when using the fiji to analyze my images. I am using 1 TB windows PC with 32 GB RAM. When I am running the FIji for quantification then my RAM space occupancy goes to almost 20 GB an dthe software become very slow to do the anlaysis.

I feel the images which i have runned or analyzed previously are not being deleted from theFIJI and they are being stored. IS there anyway to release the memory of the closed images?
I have almost 100 samples to analyze each of 4 GB so owll need more of space in my image J software. Please suggest the needful action to be taken to work with image J smoothly.


#33

Hello @NicoKiaru and @ctrueden,

The output from the file that you gave had more then just what is below, but I believe this is what is of interest. If you want to see the rest let me know. I ran the script when I had the maximum memory set to 17MB:

##################################################################### 
Cores : 8
------------ Memory ---------------
Heap : u=70.91 m=247.50 i=256.00 Mb
Non Heap : u=94.80 m=-0.00 i=-0.00 Mb
RT free mem : 175.44519805908203125 Mb
RT total mem : 247.5 Mb
RT max mem : 247.5 Mb

##############################################################################

I changed the max memory to 15MB and this was the output for the memory section:

########################################################
------------ Memory ---------------
Heap : u=88.54 m=247.50 i=256.00 Mb
Non Heap : u=87.37 m=-0.00 i=-0.00 Mb
RT free mem : 157.86145782470703125 Mb
RT total mem : 247.5 Mb
RT max mem : 247.5 Mb
#########################################################

Unfortunately, I do not have administrative power on the computer that we are using with fiji, but I was able to borrow someones lap top that also runs windows 10. When using the same version of fiji and java it was able to successfully run. I am not sure what this tells us, but hopefully someone here does.

Sorry for the long delay life became very hectic for a while.

-Carl


#34

Hey @llamaswithhats , thanks, but all the output could be useful as well. Please post it.

Best


#35

@NicoKiaru

Here is the full output for the last run:

Started New_.groovy at Thu Jun 07 14:50:05 PDT 2018
------------ System ---------------
ij.dir:C:\Users\SHAMU\DOWNLO~1\FIJI-W~1\Fiji.app
java.runtime.name:Java(TM) SE Runtime Environment
fiji.dir:C:\Users\SHAMU\DOWNLO~1\FIJI-W~1\Fiji.app
imagej.dir:C:\Users\SHAMU\DOWNLO~1\FIJI-W~1\Fiji.app
sun.boot.library.path:C:\Users\SHAMU\DOWNLO~1\FIJI-W~1\Fiji.app\java\win64\jdk1.8.0_172\jre\bin
java.vm.version:25.172-b11
fiji.defaultLibPath:bin/server/jvm.dll
java.vm.vendor:Oracle Corporation
java.vendor.url:http://java.oracle.com/
path.separator:;
java.vm.name:Java HotSpot(TM) 64-Bit Server VM
file.encoding.pkg:sun.io
user.country:US
user.script:
sun.os.patch.level:
java.vm.specification.name:Java Virtual Machine Specification
user.dir:C:\Users\SHAMU\Downloads\fiji-win64\Fiji.app
java.runtime.version:1.8.0_172-b11
scijava.context.strict:false
java.awt.graphicsenv:sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs:C:\Users\SHAMU\DOWNLO~1\FIJI-W~1\Fiji.app\java\win64\jdk1.8.0_172\jre\lib\endorsed
os.arch:amd64
java.io.tmpdir:C:\Users\SHAMU\AppData\Local\Temp\
line.separator:

java.vm.specification.vendor:Oracle Corporation
user.variant:
os.name:Windows 10
sun.jnu.encoding:Cp1252
java.library.path:C:\Users\SHAMU\DOWNLO~1\FIJI-W~1\Fiji.app/lib/win64;C:\Users\SHAMU\DOWNLO~1\FIJI-W~1\Fiji.app/mm/win64
sun.awt.enableExtraMouseButtons:true
java.specification.name:Java Platform API Specification
java.class.version:52.0
sun.management.compiler:HotSpot 64-Bit Tiered Compilers
os.version:10.0
user.home:C:\Users\SHAMU
user.timezone:America/Los_Angeles
java.awt.printerjob:sun.awt.windows.WPrinterJob
file.encoding:Cp1252
java.specification.version:1.8
plugins.dir:C:\Users\SHAMU\DOWNLO~1\FIJI-W~1\Fiji.app
java.class.path:C:\Users\SHAMU\DOWNLO~1\FIJI-W~1\Fiji.app/jars/imagej-launcher-4.0.5.jar
user.name:SHAMU
java.vm.specification.version:1.8
java.home:C:\Users\SHAMU\DOWNLO~1\FIJI-W~1\Fiji.app\java\win64\jdk1.8.0_172\jre
sun.arch.data.model:64
user.language:en
java.specification.vendor:Oracle Corporation
awt.toolkit:sun.awt.windows.WToolkit
java.vm.info:mixed mode
java.version:1.8.0_172
java.ext.dirs:C:\Users\SHAMU\DOWNLO~1\FIJI-W~1\Fiji.app\java\win64\jdk1.8.0_172\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext
sun.boot.class.path:C:\Users\SHAMU\DOWNLO~1\FIJI-W~1\Fiji.app\java\win64\jdk1.8.0_172\jre\lib\resources.jar;C:\Users\SHAMU\DOWNLO~1\FIJI-W~1\Fiji.app\java\win64\jdk1.8.0_172\jre\lib\rt.jar;C:\Users\SHAMU\DOWNLO~1\FIJI-W~1\Fiji.app\java\win64\jdk1.8.0_172\jre\lib\sunrsasign.jar;C:\Users\SHAMU\DOWNLO~1\FIJI-W~1\Fiji.app\java\win64\jdk1.8.0_172\jre\lib\jsse.jar;C:\Users\SHAMU\DOWNLO~1\FIJI-W~1\Fiji.app\java\win64\jdk1.8.0_172\jre\lib\jce.jar;C:\Users\SHAMU\DOWNLO~1\FIJI-W~1\Fiji.app\java\win64\jdk1.8.0_172\jre\lib\charsets.jar;C:\Users\SHAMU\DOWNLO~1\FIJI-W~1\Fiji.app\java\win64\jdk1.8.0_172\jre\lib\jfr.jar;C:\Users\SHAMU\DOWNLO~1\FIJI-W~1\Fiji.app\java\win64\jdk1.8.0_172\jre\classes
java.vendor:Oracle Corporation
ij.executable:C:\Users\SHAMU\Downloads\fiji-win64\Fiji.app\ImageJ-win64.exe
python.cachedir.skip:true
file.separator:\
java.vendor.url.bug:http://bugreport.sun.com/bugreport/
sun.io.unicode.encoding:UnicodeLittle
sun.cpu.endian:little
sun.desktop:windows
fiji.executable:C:\Users\SHAMU\Downloads\fiji-win64\Fiji.app\ImageJ-win64.exe
sun.cpu.isalist:amd64
Cores : 8
------------ Memory ---------------
Heap : u=88.54 m=247.50 i=256.00 Mb
Non Heap : u=87.37 m=-0.00 i=-0.00 Mb
RT free mem : 157.86145782470703125 Mb
RT total mem : 247.5 Mb
RT max mem : 247.5 Mb

#36

Just to be sure, do you mean 15 GB ?


#37

Thanks for the report. If you really set the memory to 15Gb (and not 15Mb) and got this output, then I give up. Maybe someone else has an idea of what could cause the problem.

(but first please check you entered 15 Gb and not 15Mb)

Sorry, and good luck!


#38

Yeah Sorry 15Gb not Mb.


#39

@llamaswithhats Here are some questions and things to try: