You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by rv...@apache.org on 2017/06/09 10:17:54 UTC
jena git commit: Fix for JENA-1356
Repository: jena
Updated Branches:
refs/heads/master 3baf1a36f -> d64d555cc
Fix for JENA-1356
Generalize free memory detection on OS X to cope with different free
memory units based upon approach suggested by Joshua Portway
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/d64d555c
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/d64d555c
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/d64d555c
Branch: refs/heads/master
Commit: d64d555cc5981466b0cf4d25d8be6b299be685cd
Parents: 3baf1a3
Author: Rob Vesse <rv...@apache.org>
Authored: Fri Jun 9 11:17:15 2017 +0100
Committer: Rob Vesse <rv...@apache.org>
Committed: Fri Jun 9 11:17:15 2017 +0100
----------------------------------------------------------------------
apache-jena/bin/tdbloader2common | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/d64d555c/apache-jena/bin/tdbloader2common
----------------------------------------------------------------------
diff --git a/apache-jena/bin/tdbloader2common b/apache-jena/bin/tdbloader2common
index 136471d..b4841cd 100644
--- a/apache-jena/bin/tdbloader2common
+++ b/apache-jena/bin/tdbloader2common
@@ -93,8 +93,28 @@ function getFreeMem() {
darwin*)
# Have to get this from top
FREE_MEM=$(top -l 1 | grep PhysMem | awk '{print $6}')
- FREE_MEM=${FREE_MEM%M}
- FREE_MEM=$(($FREE_MEM * 1024 * 1024))
+ MEM_UNIT=${FREE_MEM:${#FREE_MEM}-1:1}
+ FREE_MEM=${FREE_MEM%${MEM_UNIT}}
+ case "${MEM_UNIT}" in
+ K)
+ # Unlikely but let's cover our bases
+ FREE_MEM=$((${FREE_MEM} * 1024))
+ ;;
+ M)
+ FREE_MEM=$((${FREE_MEM} * 1024 * 1024))
+ ;;
+ G)
+ FREE_MEM=$((${FREE_MEM} * 1024 * 1024 * 1024))
+ ;;
+ T)
+ # Probably a ways off but let's be future proof
+ FREE_MEM=$((${FREE_MEM} * 1024 * 1024 * 1024 * 1024))
+ ;;
+ *)
+ # Unable to determine
+ FREE_MEM=-1
+ ;;
+ esac
;;
linux*)
# Try to use free if available