Out of memory error, but not actually

I am having some memory issues. It keeps running out of memory, saying I have used all 494 MB of available memory. I have a 32 gb system, and have set the maximum memory to 28672. In addition, the memory information in the status bar says using 399 mb of 28672, same thing in the about ImageJ menu too. When trying to perform a task (in this case, just taking the log of am 8330x9504 image, I get the error. I get it with a lot of other things as well. As I watch the memory usage on the system, ImageJ never climbs any higher. I am using Windows 7 Ultimate. And yes, I have the 64 bit version of ImageJ and 64 bit Java installed and updated as well.

Honestly, I am also having a similar issue with a different program, that also uses Java. Does anyone have any tips or know how to solve this problem?

What is your computers memory usage? Is there anything that might be competing with ImageJ for memory?

Just a few GB. Same issue even after a fresh restart and nothing else has been opened except ImageJ. So I have ~30gb of free memory. But ImageJ will still only try to address ~500mb.

Could you take a post a screen shot of the memory setting immediate after opening ImageJ and the status bar when you run out of memory? Just so we can verify the situation.

Hey @shanezsullivan,

would you mind sharing the error message you get? That would help us identifying the issue.


Attached are screenshots of the error message, the status bar, and windows task manager showing the memory usage. Because I can not click the Status bar with the setting option opened, that is attached separately. Note, I have not add this problem on half a dozen other computers, some with more memory, some with less. The major difference I perceive is that Windows 7 Ultimate.

Odd. That is the same version I have and I haven’t been having issues with memory. Have you tried a new copy of Fiji?

Yes, I have tried different version. Same issue also with vanilla ImageJ. I really think it has something to do with the Windows 7 Ultimate. I do not have the issue on Win 7 pro, or any variant of Windows 10. Granted, those are also different computers. I am also using another program that uses Java, and am always running out of memory with it, but not actually running out of memory. I tried initially through that programs initial help support and community, and they had no clue. So I switched to doing everything manually between Matlab and ImageJ, but ran into the ImageJ memory issue as well. But Matlab has no issue using all the memory up, which is why I think it is Java related.

Have you tried a different version of Java, or reinstalling it? Based on this new information, it sounds like it might be a problem withe Java VM itself.


Yes, I have tried reinstalling Java and different versions as well.

I have finally figured out the issue. Posting solution in case anyone else comes across issue with google-fu. Despite setting the maximum memory in ImageJ for java, and despite setting the maximum memory higher in the java settings in the Java control panel configuration in Windows 7 Ultimate. Windows 7 Ultimate sets an environmental variable that apparently overrides all other Java variables limiting things. To fix the issue you need to go to the Environmental Variables of Windows 7 Ultimate (Control Panel/ System / Advanced System Settings | Advanced (tab) \ Environment Variables) And under the System Variables set the _JAVA_OPTIONS variable to larger, example -Xmx25g to use 25gigs of memory. So annoying.