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

memory
fiji
Tags: #<Tag:0x00007fb87a19cfa0> #<Tag:0x00007fb87a19cdc0>

#1

Hi everyone,
It’s my first time posting here so I hope I’m not making too many mistakes.

I’m using Fiji for a student project about biofilms, and I’ve been having this memory problem when trying to open a ~400MB .tif file, containing 97 images : Fiji cannot load more than ~50 images, and the following error notification pops up.

Out of memory. All of available memory (247MB) has been used. To make more available, use the Edit>Options>Memory&threads command.

out_of_memory

I have changed the maximum memory to 2048MB (even tried more than 4Go) in the Memory&Threads, and yet the error message is still the same. I am using the latest version of Fiji 64-bit (I have tried installing life-line versions and it doesn’t change anything), I have reinstalled Java JRE 64-bit, my JRE settings are -Xmx2048M

JRE_settings

When i check the imagej.cfg file, it reads
.
jre\bin\javaw.exe
-Xmx2048m -cp ij.jar ij.ImageJ

On top of that, the ImageJ status bar indicates that less than 1% of RAM is being used (18MB of 2048MB).

status_bar

I’ve been trying to solve this problem for hours, trying everything I’ve seen on the internet, but nothing seems to work. I would be extremely grateful if someone could tell me what I’m missing.

Thank you, Erwan


#2

Hi Erwan,

you wrote that your image is ~400MB .tif file, containing 97 images.

What is the “geometry” of the file ? channel, slices , time-point ? dimension in x and y ?
Did you try to import using virtual stack ?

Best,

Romain


#3

Hi Romain,

I’m not sure I understand everything you asked me (I’m very new to ImageJ and image analysis overall) but I’ll try my best to answer :

  • dimension in x and y is 10241024 pixels (185185 microns)
  • 1 channel
  • 1 frame
  • 97 slices

What grinds my gears the most is that the friends with who I work on this project have absolutely no problem opening the file at all (even without using TIFF Virtual Stack), and they don’t get the error message that I always get, although I don’t see any difference between their settings and mine.

Importing using virtual stack works for me, but I need to make it work using only the “Open…” command because the macro I use to analyse the image uses the “Open…” command, and not the “TIFF Virtual Stack…” command.

Thank you, Erwan


#4

Good day,

so your image stack should be about 100MB which, as you write, should pose no problems to open.

Now please try the following:

  1. Quit ImageJ
  2. Start ImageJ without any images
  3. Go to “File >> New >> Image…”
  4. Enter Type: 8-bit; Fill with: Noise; Width: 1024; Height: 1024; Slices: 97; Click OK
  5. Save the stack as TIFF to disk
  6. Open this stack from disk
  7. Report what happens

Regards

Herbie


#5

Hi Herbie,
I followed the exact steps you mentioned, imageJ had no problem creating the stack, and I can open it without a problem using both ImageJ or the Windows stock Image Viewer.
The TIFF file created was 99MB.

Thanks, Erwan


#6

Erwan,

if the generated stack works, then there is something wrong with your images.

If you check the size of your file and if it is larger than about 100 MB, then your above specification is wrong. Are your images RGB-color images, i.e. more than one channel?

Clueless

Herbie


#7

Hi Herbie,
I think I know why the TIFF file is 400MB and not 100MB : it is 32-bit image and not 8-bit !

However, even if I manage to reduce the size of this image and make it less than 247MB, I still won’t understand why Fiji won’t open bigger files although I have set it’s maximum memory to 2048MB. If in the future I want to work with bigger images I will be blocked :confused:

Thanks, Erwan


#8

Don’t get desperate yet!

Did you try

  1. Quit ImageJ
  2. Start ImageJ without any images
  3. Go to “File >> New >> Image…”
  4. Enter Type: 32-bit; Fill with: Noise; Width: 1024; Height: 1024; Slices: 97; Click OK
  5. Save the stack as TIFF to disk
  6. Open this stack from disk
  7. Report what happens

Is there another corpulent application running on your computer?
Where is your image file located, on your PC or on a server?

Regards

Herbie


#9

I just tried what you indicate and the error message pops up again !

out_of_mem_2

The file I’m trying to create is supposed to be 388MB according to the status bar.

No, I do not have any other corpulent application, and my computer has 8Go RAM and is pretty powerful.

Thanks, Erwan


#10

Thanks for testing!

Now we can be sure that the trouble is not with your image file but with either Fiji or your PC.

What version of ImageJ are you using and what version of Java?
See:
Ohne Titel-1

Are you opening your image file with bioformats or with the ImageJ open command.

How do you open your image file, per drag and drop, per menu or other?

Regards

Herbie


#11

I am using the following versions of Fiji is just ImageJ and Java :

status_bar

The 2 cases in which I’ve encountered the problem were : either opening the image file per menu and clicking on the “File>Open…” command ; or opening the file with an ImageJ macro, the first lines of which are :

//OpenFile
Pathdata = File.openDialog(“Select the file”);

Thanks, Erwan


#12

ERRATUM :

Actually I was wrong when describing how the macro opens the image : I think it is using the Bio-Formats Importer to do so. The whole block of code is :

//OpenFile
Pathdata = File.openDialog(“Select the file”);
Dirdata = File.getParent(Pathdata);
Namedata = File.getName(Pathdata);
Namedata_withoutExtension = File.nameWithoutExtension;
print(Pathdata);
print(Dirdata);
print(Namedata);
Worked_Data_Path = Dirdata+"\"+Namedata_withoutExtension+File.separator;
print(Worked_Data_Path);
File.makeDirectory(Worked_Data_Path);
run(“Bio-Formats”, “open=”+Pathdata+" autoscale color_mode=Default view=Hyperstack stack_order=XYCZT");

I have tried to manually open the image with the Bio-Formats Importer, with the following import options :

And when I click “OK”, I get the following warning message :

bioformats_message

And eventually, when I click “OK” in this window, I get the “Out of memory” log again.

outofmemory_bioformats

I find it pretty confusing that the Bio-Formats warning message indicates an available memory of 161MB, which is different from the 247MB of the initial problem I encounter, and obviously very different from the 2048MB I have set up in “Memory&Threads”.

Thanks, Erwan


#13

Good day Erwan,

thanks for the details that should help to diagnose the problem.

I fear that you don’t have enough free RAM available which is a problem of your PC and the software running on it. You can set as much memory you want for ImageJ/Fiji, but if the amount of RAM isn’t available on your PC, it can’t be used by ImageJ.

Try to diagnose your PC for memory usage. You wrote that your PC has 8GB of RAM installed and you should get an idea about how much of it is availbale if ImageJ is not running. Did you try restarting your PC and are there any processes running in the background such as Virus-Scanners etc. You have to find out.

Good luck

Herbie


#14

Hi Herbie,

I am afraid the amount of RAM available on my PC is not the problem : when checking my task manager, it indicates that less than half of the RAM is being used, which means that there should be about 4GB available for use by ImageJ. You can see on the following screenshot that only 44% of RAM is being used (second column).

Another fact that makes me doubt it’s coming from the computer memory is the fact that the ImageJ error log always specifies that 247MB has been used : if it was really the computer lacking some available RAM, that amount (247MB) should probably not be the same each time I try to open the file, since I do not always have the same programs running in the background of my computer.

Thanks, Erwan


#15

Thanks again for the data and yes, what you write makes sense.

I must admit that at the moment I’ve no idea for further steps of analysis and help.

Perhaps someone else here on the Forum can help further.

Sorry but I shall still reflect about the problem …

Regards

Herbie


#16

Thanks for your help anyway Herbie !

I’m hoping someone else will come up with new ideas :slight_smile:

Erwan


#17

Hi @Erwan,

Please try
Edit > Options > Memory & Threads
and see what is written in the Maximum Memory field.
Then increase that number and restart ImageJ.

I’m hopeful that this will address the issue.
Then try opening your images and/or repeating the experiments @Herbie walked you through, and report back to let us know what happens.

Good luck,
John


#18

Hi @bogovicj,

As mentioned earlier, I have already set the maximum memory to a pretty high level (2GB).

max_memory

I have even tried to raise it to 4GB and even 5GB, but it changes absolutely nothing at all : that same error message always pops up, always indicating the same value of 247MB :

out_of_mem_2

Thanks, Erwan


#19

Erwan,

just an aside: Please uncheck “Keep multiple undo buffers”!

If multiple processing steps are to be reversed you need to store all image versions that occure during the processing making the memory requirement rather high!

Regards

Herbie


#20

Have you tried starting as an administrator (right-click, “run as administrator”) ? Maybe you lack some permissions ?

Sorry, you’ve already done that!