message notification of the free RAM. Issue #1295

This commit is contained in:
Jacky 2017-11-10 15:44:05 -05:00
parent a53467f2cb
commit d10eb388a7
2 changed files with 22 additions and 0 deletions

12
refine
View File

@ -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

View File

@ -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