64bit ImageJ memory limit error: utter nonsense

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

64bit ImageJ memory limit error: utter nonsense

Matthias
Physical RAM: 8Gb
OS: 64bit Ubuntu 10.10
Virtual memory: 7.5Gb

The official instructions make no sense, because there is no such location as:
./jre/bin/java -Xmx512m -cp ij.jar ij.ImageJ

Did this apply to an earlier version of ImageJ or something?

I tried taking matters into my own hands so to speak by editing the imagej config file (below) and this did work to an extent, which is to say that imageJ was able to use more than 1Gb or whatever the underwhelming default was to 4.8Gb now. But where on earth it gets its 4.8 Gb limitation from is both a source of frustration and an embarrassment to imageJ on 64-bit operating systems, particularly since ImageJ spits its dummy with more than 3Gb remaining + 7.5 Gb virtual memory. I don't know what else to do besides what I have done below
 

usr/bin/imagej
-----------------

declare -i mem
declare -i default_mem=5000
declare -i min_mem=5000
declare -i max_mem=7000
declare -i free_mem

# max memory allocation is 1800MB on 32bit java and 4000 on 64bit java
if [[ `uname` == 'SunOS' ]] ; then
    arch='-d64'
        java_path="${ij_path}/jre64/bin/java"
        max_mem=`vmstat | awk 'NR == 3 {fmem=int($5 / 1024); if (fmem < 4000) {print fmem} else {print 4000}}'`
        free_mem="max_mem"
        mem=${free_mem}/10*10
        if (( $mem > $default_mem || $mem < $min_mem )) ; then mem=$default_mem ; fi
elif [[ `uname` == 'Linux' ]] ; then
        if [[ `uname -m` == 'x86_64' ]] ; then
    arch='-d64'
    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}/10*10
                if (( $mem > $default_mem || $mem < $min_mem )) ; then mem=$default_mem ; fi
        else
                arch='-d32'
    java_path="${ij_path}/jre/bin/java"
    free_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}/10*10
                if (( $mem > $default_mem || $mem < $min_mem )) ; then mem=$default_mem ; fi
        fi
fi