[ 
https://issues.apache.org/jira/browse/JENA-1356?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

joshua portway updated JENA-1356:
---------------------------------
    Description: 
tbloader2 crashes during the sort phase because when checking for free memory 
because top reports memory measured in gigabytes ("10G") rather than megabytes 
and the script (getFreeMem in tbloader2common)  is hard coded to expect the 
memory to be expressed in megabytes ("10M").

The bug can be fixed by checking which unit is used:

{code}
case "$OSTYPE" in
    darwin*)
      # Have to get this from top
      FREE_MEM=$(top -l 1 | grep PhysMem | awk '{print $6}')
      MEM_LEN=${#FREE_MEM}
      MEM_UNIT=${FREE_MEM:MEM_LEN-1:1}
      if [ $MEM_UNIT == 'M' ]; then
        FREE_MEM=${FREE_MEM:0:MEM_LEN-1}
        FREE_MEM=$(($FREE_MEM * 1024 *1024))
      fi
      if [ $MEM_UNIT == 'G' ]; then
        FREE_MEM=${FREE_MEM:0:MEM_LEN-1}
        FREE_MEM=$(($FREE_MEM * 1024 *1024 * 1024))
      fi
      ;;
{code}

  was:
tbloader2 crashes during the sort phase because when checking for free memory 
because top reports memory measured in gigabytes ("10G") rather than megabytes 
and the script (getFreeMem in tbloader2common)  is hard coded to expect the 
memory to be expressed in megabytes ("10M").

The bug can be fixed by checking which unit is used:

{{
case "$OSTYPE" in
    darwin*)
      # Have to get this from top
      FREE_MEM=$(top -l 1 | grep PhysMem | awk '{print $6}')
      MEM_LEN=${#FREE_MEM}
      MEM_UNIT=${FREE_MEM:MEM_LEN-1:1}
      if [ $MEM_UNIT == 'M' ]; then
        FREE_MEM=${FREE_MEM:0:MEM_LEN-1}
        FREE_MEM=$(($FREE_MEM * 1024 *1024))
      fi
      if [ $MEM_UNIT == 'G' ]; then
        FREE_MEM=${FREE_MEM:0:MEM_LEN-1}
        FREE_MEM=$(($FREE_MEM * 1024 *1024 * 1024))
      fi
      ;;
}}


> tbloader2 crashes on OSX with "value too great for base" error
> --------------------------------------------------------------
>
>                 Key: JENA-1356
>                 URL: https://issues.apache.org/jira/browse/JENA-1356
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: Cmd line tools
>    Affects Versions: Jena 3.3.0
>         Environment: Mac OSX 10.12.5
>            Reporter: joshua portway
>              Labels: easyfix
>
> tbloader2 crashes during the sort phase because when checking for free memory 
> because top reports memory measured in gigabytes ("10G") rather than 
> megabytes and the script (getFreeMem in tbloader2common)  is hard coded to 
> expect the memory to be expressed in megabytes ("10M").
> The bug can be fixed by checking which unit is used:
> {code}
> case "$OSTYPE" in
>     darwin*)
>       # Have to get this from top
>       FREE_MEM=$(top -l 1 | grep PhysMem | awk '{print $6}')
>       MEM_LEN=${#FREE_MEM}
>       MEM_UNIT=${FREE_MEM:MEM_LEN-1:1}
>       if [ $MEM_UNIT == 'M' ]; then
>         FREE_MEM=${FREE_MEM:0:MEM_LEN-1}
>         FREE_MEM=$(($FREE_MEM * 1024 *1024))
>       fi
>       if [ $MEM_UNIT == 'G' ]; then
>         FREE_MEM=${FREE_MEM:0:MEM_LEN-1}
>         FREE_MEM=$(($FREE_MEM * 1024 *1024 * 1024))
>       fi
>       ;;
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to