Login  Register

Re: OutOfMemoryError

Posted by foxtango on Dec 26, 2020; 4:36pm
URL: http://imagej.273.s1.nabble.com/OutOfMemoryError-tp5024312p5024319.html

Dear Wayne and Fred,

similar to Fred I do not have the file ImageJ.cfg.  -x5120 works fine.
Since Fred was wondering as to the functionality of the wrapper script, I
tried a few replacements.

line/s in the script    68     104&105    Memory & Threads
----------------------------------------------------------
8k4k  2666
4k     8k  4000
8k     8k  5332

Am Fr., 25. Dez. 2020 um 23:58 Uhr schrieb Fred Damen <[hidden email]>:

> Greetings,
>
> Shorter version of the solution to your issue is to pass -x5120 to the
> imagej bash script for 5G of memory.
>
> Longer version...
>
> I use Fedora package installation of ImageJ and do not seem to have the
> ImageJ.cfg file that Wayne has mentioned, and my imagej bash script does
> not reference ImageJ.cfg, so I do not think there is any connection
> between these two possible ways of setting this memory option.  I do not
> know how Edit>Options>Memory & Threads is supposed to work and have not
> tried to use it on Linux so I can not comment further...
>
> The code snippet that you provided below is not perfect, i.e., it defines
> default_mem to 4000 and in the subsequent code compares against the value
> 4000 and not to the value of the default_mem variable.  So changing the
> value of of the default_mem variable is mute without correcting the
> subsequent code to use $default_mem instead of 4000. Although this is the
> answer to your inquire, you can ignore this paragraph if you use the
> initial suggested solution, as it renders this code irrelevant during
> command line parameter evaluation.
>
> It is interesting that this script uses the amount of free swap as the
> free_mem instead of the actual RAM...
>
> Enjoy,
>
> Fred
>
> On Fri, December 25, 2020 3:08 pm, Wayne Rasband wrote:
> >> On Dec 25, 2020, at 6:46 AM, Thomas Fischer <[hidden email]>
> >> wrote:
> >>
> >> Hi altogether,
> >>
> >> my laptop runs under linux debian 10 and has 8 GB RAM. Edit  › Options
> >>  ›
> >> Memory & Threads does not allow me to increase the value above 2666MB.
> >
> > Try the Linux version of ImageJ available at
> > https://imagej.nih.gov/ij/download.html. The Edit>Options>Memory &
> Threads
> > command updates the third line of the ImageJ.cfg file. For example, it
> > changes this line to "-Xmx4000m -cp ij.jar ij.ImageJ” when you set the
> > value to 4000 in the Memory & Threads dialog.
> >
> > -wayne
> >
> >> relevant lines in /usr/bin/imagej (a not so simple wrapper script used
> >> to
> >> run ImageJ) are
> >>
> >> declare -i mem
> >> declare -i default_mem=4000
> >> declare -i min_mem=16
> >> declare -i max_mem
> >> declare -i free_mem
> >>
> >> and further down
> >>
> >> elif [[ `uname` == 'Linux' ]] ; then
> >>    if [[ `uname -m` == 'x86_64' ]] ; then
> >>        java_path="${ij_path}/jre64/bin/java"
> >>        max_mem=`free | awk 'NR == 2 {fmem=int($2 / 1024); if (fmem <
> >> 4000)
> >> {print fmem} else {print 4000}}'`
> >>        free_mem=`free | awk 'NR == 3 {fmem=int($4 / 1024); if (fmem <
> >> 4000) {print fmem} else {print 4000}}'`
> >>        mem=${free_mem}/3*2
> >>        if (( $mem > $default_mem || $mem < $min_mem )) ; then
> >> mem=$default_mem ; fi
> >>    else
> >>
> >> typing free:
> >>              total        used        free      shared  buff/cache
> >> available
> >> Mem:        8064332     1579956     2659136      183288     3825240
> >> 5998348
> >> Swap:       8282108           0     8282108
> >>
> >> changing declare -i default_mem=4000 to declare -i default_mem=8000 has
> >> no
> >> effect on the lines further down
> >>
> >> where is the superior position where the change to 8000 makes a
> >> difference
> >> in the file imagej?
> >>
> >> thank you, Thomas
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Thomas