Skip to content

Commit

Permalink
Merge pull request #1321 from jackyq2015/master
Browse files Browse the repository at this point in the history
message notification of the free RAM. Issue #1295
  • Loading branch information
jackyq2015 committed Nov 10, 2017
2 parents bdd87b1 + 60fb994 commit 5269cbf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions refine
Expand Up @@ -935,6 +935,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
Expand Down
10 changes: 10 additions & 0 deletions refine.bat
Expand Up @@ -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
Expand Down

0 comments on commit 5269cbf

Please sign in to comment.