From d10eb388a71440b3b074c1c5e339f5908dd6d679 Mon Sep 17 00:00:00 2001 From: Jacky Date: Fri, 10 Nov 2017 15:44:05 -0500 Subject: [PATCH] message notification of the free RAM. Issue #1295 --- refine | 12 ++++++++++++ refine.bat | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/refine b/refine index 63a2fe2ca..a54684464 100755 --- a/refine +++ b/refine @@ -934,6 +934,18 @@ if [ -z "$REFINE_MIN_MEMORY" ] ; then fi add_option "-Xms$REFINE_MIN_MEMORY -Xmx$REFINE_MEMORY -Drefine.memory=$REFINE_MEMORY" +freeRam=UNKNOWN +if [ "$OS" = "macosx" ] ; then + freeRam=$(top -l 1 | grep PhysMem | awk '{print $6}' | tr -d M) +elif [ "$OS" = "linux" ] ; then + freeRam=$(free -m | grep -oP '\d+' | head -n 1) +fi + +echo You have "$freeRam"M of free memory. +echo You current configuration will allow to use $REFINE_MEMORY of memory. +echo OpenRefine can run better when given more memory. Read our FAQ on how to allocate more memory here: +echo https://github.com/OpenRefine/OpenRefine/wiki/FAQ:-Allocate-More-Memory + if [ -z "$REFINE_MAX_FORM_CONTENT_SIZE" ] ; then REFINE_MAX_FORM_CONTENT_SIZE="1048576" fi diff --git a/refine.bat b/refine.bat index c9b340834..a7668afad 100644 --- a/refine.bat +++ b/refine.bat @@ -137,9 +137,19 @@ if not "%REFINE_MEMORY%" == "" goto gotMemory set REFINE_MEMORY=1024M if not "%REFINE_MIN_MEMORY%" == "" goto gotMemory set REFINE_MIN_MEMORY=256M + :gotMemory set OPTS=%OPTS% -Xms%REFINE_MIN_MEMORY% -Xmx%REFINE_MEMORY% -Drefine.memory=%REFINE_MEMORY% +rem --- Check free memory --------------------------------------------- +for /f "usebackq skip=1 tokens=*" %%i in (`wmic os get FreePhysicalMemory ^| findstr /r /v "^$"`) do @set /A freeRam=%%i/1024 + +echo You have %freeRam%M of free memory. +echo You current configuration will allow to use %REFINE_MEMORY% of memory. +echo OpenRefine can run better when given more memory. Read our FAQ on how to allocate more memory here: +echo https://github.com/OpenRefine/OpenRefine/wiki/FAQ:-Allocate-More-Memory +echo . + if not "%REFINE_MAX_FORM_CONTENT_SIZE%" == "" goto gotMaxFormContentSize set REFINE_MAX_FORM_CONTENT_SIZE=1048576 :gotMaxFormContentSize