Skip to content
Permalink
Browse files
fix mem setting on windws when using 64-bit Java
  • Loading branch information
xiaoyekanren committed Sep 8, 2020
1 parent 7e2dbc6 commit b0b943a372e04b0fa8128ccc3d7e340b74a1631f
Showing 1 changed file with 9 additions and 4 deletions.
@@ -44,14 +44,19 @@ if %JMX_LOCAL% == "false" (
echo "setting local JMX..."
)

@REM Maximum heap size
set MAX_HEAP_SIZE=2G
@REM Minimum heap size
set HEAP_NEWSIZE=2G

IF ["%IOTDB_HEAP_OPTS%"] EQU [""] (
rem detect Java 8 or 11
IF "%JAVA_VERSION%" == "8" (
java -d64 -version >nul 2>&1
IF NOT ERRORLEVEL 1 (
rem 64-bit Java
echo Detect 64-bit Java, maximum memory allocation pool = 2GB, initial memory allocation pool = 2GB
set IOTDB_HEAP_OPTS=-Xmx2G -Xms2G -Xloggc:"%IOTDB_HOME%\gc.log" -XX:+PrintGCDateStamps -XX:+PrintGCDetails
echo Detect 64-bit Java, maximum memory allocation pool = %MAX_HEAP_SIZE%B, initial memory allocation pool = %HEAP_NEWSIZE%B
set IOTDB_HEAP_OPTS=-Xmx%MAX_HEAP_SIZE% -Xms%HEAP_NEWSIZE% -Xloggc:"%IOTDB_HOME%\gc.log" -XX:+PrintGCDateStamps -XX:+PrintGCDetails
) ELSE (
rem 32-bit Java
echo Detect 32-bit Java, maximum memory allocation pool = 512MB, initial memory allocation pool = 512MB
@@ -72,8 +77,8 @@ for /f "tokens=1-3" %%j in ('java -version 2^>^&1') do (
)
IF "%BIT_VERSION%" == "64-Bit" (
rem 64-bit Java
echo Detect 64-bit Java, maximum memory allocation pool = 2GB, initial memory allocation pool = 2GB
set IOTDB_HEAP_OPTS=-Xmx2G -Xms2G
echo Detect 64-bit Java, maximum memory allocation pool = %MAX_HEAP_SIZE%B, initial memory allocation pool = %HEAP_NEWSIZE%B
set IOTDB_HEAP_OPTS=-Xmx%MAX_HEAP_SIZE% -Xms%HEAP_NEWSIZE%
) ELSE (
rem 32-bit Java
echo Detect 32-bit Java, maximum memory allocation pool = 512MB, initial memory allocation pool = 512MB

0 comments on commit b0b943a

Please sign in to comment.