[Debian-med-packaging] Bug#986041: imagej script bug in a system with no swap
Alexis PM
miscelaneanatural at yahoo.es
Sun Mar 28 14:50:02 BST 2021
Package: imagej
Version: 1.52j-1
Severity: important
Hello
In a system with no swap:
$ free
total used free shared buff/cache available
Mem: 508080 56612 69872 368 381596 437904
Swap: 0 0 0
The imagej script:
# max memory allocation is 1800MB on 32bit java and 4000 on 64bit java
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
java_path="${ij_path}/jre/bin/java"
max_mem=`free | awk 'NR == 2 {fmem=int($2 / 1024); if (fmem < 1800) {print fmem} else {print 1800}}'`
free_mem=`free | awk 'NR == 3 {fmem=int($4 / 1024); if (fmem < 1800) {print fmem} else {print 1800}}'`
mem=${free_mem}/3*2
if (( $mem > $default_mem || $mem < $min_mem )) ; then mem=$default_mem ; fi
fi
fi
This results in:
java_path = /jre/bin/java
max_mem = 496
free_mem = 0
mem = 0/3*2
Due to the "0" value:
(( 0 > 4000 || 0 < 16 ))
mem=4000
and as the system does not have so much RAM the final result is:
Error occurred during initialization of VM
Could not reserve enough space for 4096000KB object heap
Thank you very much.
More information about the Debian-med-packaging
mailing list