OutOfMemoryError

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

OutOfMemoryError

foxtango
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.

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
Thomas
Reply | Threaded
Open this post in threaded view
|

Re: OutOfMemoryError

Wayne Rasband-2
> 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
Reply | Threaded
Open this post in threaded view
|

Re: OutOfMemoryError

Fred Damen
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
Reply | Threaded
Open this post in threaded view
|

Re: OutOfMemoryError

Herbie
In reply to this post by foxtango
Perhaps you are still running a 32bit version of ImageJ ?

If not, this may help:

<https://imagej.nih.gov/ij/docs/install/linux.html>

"The -Xmx4096m switch specifies that ImageJ will have available a
maximum of 4096MB (4GB) of RAM."

<https://imagej.nih.gov/ij/docs/guide/146-27.html#toc-Subsection-27.13>

"27.13.12 Memory & Threads…
[...] Note that specifying more than 75% of real RAM could result in
virtual RAM being used, which may cause ImageJ to become slow and
unstable. [...]"

Happy holidays

Herbie

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: OutOfMemoryError

foxtango
In reply to this post by Fred Damen
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
Reply | Threaded
Open this post in threaded view
|

Re: OutOfMemoryError

foxtango
the list did not allow to send the attachment.

With best seasonal greetings, Thomas

Am Sa., 26. Dez. 2020 um 17:41 Uhr schrieb Thomas Fischer <
[hidden email]>:

> Thomas Fischer
> 17:36 (vor 0 Minuten)
>
> line/s in the script    68     104&105    Memory & Threads
> ----------------------------------------------------------
>                                     8k     4k                 2666
>                                     4k     8k                 4000
>                                     8k     8k                  5332
>
> in case you are interested, I attach the script
>
> With best seasonal greetings, Thomas
>
>
>
> Am Sa., 26. Dez. 2020 um 17:36 Uhr schrieb Thomas Fischer <
> [hidden email]>:
>
>> 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