Disable explicit GC by default

We don't rely upon GC to cleanup mappedbytebuffers, we unmap them
explicitly on close in lucene. But the JDK has crazy loops with
explicit GCs in exceptional cases to try to force unmapping.

In general we don't want any of our code or library code calling
this method: so its banned in forbidden-apis as well.
This commit is contained in:
Robert Muir 2014-06-27 13:02:26 +02:00
parent b2685f132a
commit a3d5381392
4 changed files with 12 additions and 0 deletions

View File

@ -62,6 +62,9 @@ REM The path to the heap dump location, note directory must exists and have enou
REM space for a full heap dump. REM space for a full heap dump.
REM JAVA_OPTS=%JAVA_OPTS% -XX:HeapDumpPath=$ES_HOME/logs/heapdump.hprof REM JAVA_OPTS=%JAVA_OPTS% -XX:HeapDumpPath=$ES_HOME/logs/heapdump.hprof
REM Disables explicit GC
set JAVA_OPTS=%JAVA_OPTS% -XX:+DisableExplicitGC
set ES_CLASSPATH=%ES_CLASSPATH%;%ES_HOME%/lib/${project.build.finalName}.jar;%ES_HOME%/lib/*;%ES_HOME%/lib/sigar/* set ES_CLASSPATH=%ES_CLASSPATH%;%ES_HOME%/lib/${project.build.finalName}.jar;%ES_HOME%/lib/*;%ES_HOME%/lib/sigar/*
set ES_PARAMS=-Delasticsearch -Des-foreground=yes -Des.path.home="%ES_HOME%" set ES_PARAMS=-Delasticsearch -Des-foreground=yes -Des.path.home="%ES_HOME%"

View File

@ -62,3 +62,6 @@ JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError"
# The path to the heap dump location, note directory must exists and have enough # The path to the heap dump location, note directory must exists and have enough
# space for a full heap dump. # space for a full heap dump.
#JAVA_OPTS="$JAVA_OPTS -XX:HeapDumpPath=$ES_HOME/logs/heapdump.hprof" #JAVA_OPTS="$JAVA_OPTS -XX:HeapDumpPath=$ES_HOME/logs/heapdump.hprof"
# Disables explicit GC
JAVA_OPTS="$JAVA_OPTS -XX:+DisableExplicitGC"

View File

@ -160,6 +160,9 @@ REM The path to the heap dump location, note directory must exists and have enou
REM space for a full heap dump. REM space for a full heap dump.
REM JAVA_OPTS=%JAVA_OPTS% -XX:HeapDumpPath=$ES_HOME/logs/heapdump.hprof REM JAVA_OPTS=%JAVA_OPTS% -XX:HeapDumpPath=$ES_HOME/logs/heapdump.hprof
REM Disables explicit GC
set JAVA_OPTS=%JAVA_OPTS% -XX:+DisableExplicitGC
if "%DATA_DIR%" == "" set DATA_DIR=%ES_HOME%\data if "%DATA_DIR%" == "" set DATA_DIR=%ES_HOME%\data
if "%WORK_DIR%" == "" set WORK_DIR=%ES_HOME% if "%WORK_DIR%" == "" set WORK_DIR=%ES_HOME%

View File

@ -51,5 +51,8 @@ java.lang.Object#notifyAll()
java.lang.Math#abs(int) java.lang.Math#abs(int)
java.lang.Math#abs(long) java.lang.Math#abs(long)
@defaultMessage Please do not try to stop the world
java.lang.System#gc()
@defaultMessage Use Long.compare instead we are on Java7 @defaultMessage Use Long.compare instead we are on Java7
com.google.common.primitives.Longs#compare(long,long) com.google.common.primitives.Longs#compare(long,long)