You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2018/12/03 19:31:20 UTC

[GitHub] lkishalmi closed pull request #1007: [NETBEANS-1605] Removed NetBeans max HeapSize heuristics.

lkishalmi closed pull request #1007: [NETBEANS-1605] Removed NetBeans max HeapSize heuristics.
URL: https://github.com/apache/incubator-netbeans/pull/1007
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/nb/ide.launcher/netbeans.conf b/nb/ide.launcher/netbeans.conf
index d08118435e..171d19f2e7 100644
--- a/nb/ide.launcher/netbeans.conf
+++ b/nb/ide.launcher/netbeans.conf
@@ -51,22 +51,18 @@ netbeans_default_cachedir="${DEFAULT_CACHEDIR_ROOT}/dev"
 # Options used by NetBeans launcher by default:
 # (can be overridden by explicit command line switches)
 #
-# Note that default -Xmx is selected for you automatically.
+# Note that default -Xmx is selected for you by the JVM automatically.
 # You can find these values in var/log/messages.log file in your userdir.
 # The automatically selected value can be overridden by specifying -J-Xmx
 # here or on the command line.
 #
-# If you specify the heap size explicitly, you may also want to enable
-# Concurrent Mark & Sweep garbage collector.
-# (see http://wiki.netbeans.org/FaqGCPauses)
-#
 # JDK 11 made GTK 3 default on Linux. Unfortunately it makes
 # NetBeans ugly on Linux with the default GTK+ Look and Feel,
 # as a workaround -J-Djdk.gtk.version=2.2 has been added to the 
 # default command line arguments.
 # (see: https://issues.apache.org/jira/browse/NETBEANS-1344)
 #
-netbeans_default_options="-J-XX:+UseStringDeduplication -J-Xss2m -J-Xms32m -J-Dnetbeans.logger.console=true -J-ea -J-Djdk.gtk.version=2.2 -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true -J-Dplugin.manager.check.updates=false -J-Dnetbeans.extbrowser.manual_chrome_plugin_install=yes -J--add-opens=java.base/java.net=ALL-UNNAMED -J--add-opens=java.base/java.lang.ref=ALL-UNNAMED -J--add-opens=java.base/java.lang=ALL-UNNAMED -J--add-opens=java.base/java.security=ALL-UNNAMED -J--add-opens=java.base/java.util=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing.text=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing=ALL-UNNAMED -J--add-opens=java.desktop/java.awt=ALL-UNNAMED -J--add-opens=java.desktop/java.awt.event=ALL-UNNAMED -J--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED -J--add-opens=jdk.jshell/jdk.jshell=ALL-UNNAMED -J--add-modules=jdk.jshell -J--add-exports=java.desktop/sun.awt=ALL-UNNAMED -J--add-exports=java.desktop/java.awt.peer=ALL-UNNAMED -J--add-exports=java.desktop/com.sun.beans.editors=ALL-UNNAMED -J--add-exports=java.desktop/sun.swing=ALL-UNNAMED -J--add-exports=java.desktop/sun.awt.im=ALL-UNNAMED -J--add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED -J--add-exports=java.management/sun.management=ALL-UNNAMED -J--add-exports=java.base/sun.reflect.annotation=ALL-UNNAMED -J--add-exports=jdk.javadoc/com.sun.tools.javadoc.main=ALL-UNNAMED -J-XX:+IgnoreUnrecognizedVMOptions"
+netbeans_default_options="-J-XX:+UseStringDeduplication -J-Xss2m -J-Dnetbeans.logger.console=true -J-ea -J-Djdk.gtk.version=2.2 -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true -J-Dplugin.manager.check.updates=false -J-Dnetbeans.extbrowser.manual_chrome_plugin_install=yes -J--add-opens=java.base/java.net=ALL-UNNAMED -J--add-opens=java.base/java.lang.ref=ALL-UNNAMED -J--add-opens=java.base/java.lang=ALL-UNNAMED -J--add-opens=java.base/java.security=ALL-UNNAMED -J--add-opens=java.base/java.util=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing.text=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing=ALL-UNNAMED -J--add-opens=java.desktop/java.awt=ALL-UNNAMED -J--add-opens=java.desktop/java.awt.event=ALL-UNNAMED -J--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED -J--add-opens=jdk.jshell/jdk.jshell=ALL-UNNAMED -J--add-modules=jdk.jshell -J--add-exports=java.desktop/sun.awt=ALL-UNNAMED -J--add-exports=java.desktop/java.awt.peer=ALL-UNNAMED -J--add-exports=java.desktop/com.sun.beans.editors=ALL-UNNAMED -J--add-exports=java.desktop/sun.swing=ALL-UNNAMED -J--add-exports=java.desktop/sun.awt.im=ALL-UNNAMED -J--add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED -J--add-exports=java.management/sun.management=ALL-UNNAMED -J--add-exports=java.base/sun.reflect.annotation=ALL-UNNAMED -J--add-exports=jdk.javadoc/com.sun.tools.javadoc.main=ALL-UNNAMED -J-XX:+IgnoreUnrecognizedVMOptions"
 
 # Default location of JDK:
 # (set by installer or commented out if launcher should decide)
diff --git a/nb/ide.launcher/unix/netbeans b/nb/ide.launcher/unix/netbeans
index e7fecb8e31..42c9808e5e 100644
--- a/nb/ide.launcher/unix/netbeans
+++ b/nb/ide.launcher/unix/netbeans
@@ -122,44 +122,6 @@ if [ ! -z "$netbeans_extraclusters" ] ; then
     netbeans_clusters="$netbeans_clusters:$netbeans_extraclusters"
 fi
 
-heap_size () {
-    mem=640
-    case "`uname`" in
-        Linux*)
-        mem=`cat /proc/meminfo | grep MemTotal | tr -d [:space:][:alpha:]:`
-        mem=`expr $mem / 1024`
-        ;;
-    SunOS*)
-        mem=`/usr/sbin/prtconf | grep Memory | /usr/bin/tr -dc '[0-9]'`
-        ;;
-    Darwin*)
-        mem=`/usr/sbin/sysctl hw.memsize | tr -d [:alpha:][:space:].:`
-        mem=`expr $mem / 1048576`
-        ;;
-        *) 
-        ;;
-    esac
-    if [ -z "$mem" ] ; then
-        mem=640
-    fi
-    mem=`expr $mem / 5`
-    if [ $mem -gt 1024 ] ; then
-        mem=1024
-    elif [ $mem -lt 96 ] ; then
-        mem=96
-    fi
-    max_heap_size=$mem
-    return 0
-}
-
-
-if grep -v -- "-J-Xmx" >/dev/null <<EOF ; then
-${netbeans_default_options}
-EOF
-        heap_size
-	netbeans_default_options="-J-Xmx${max_heap_size}m ${netbeans_default_options}"
-fi
-
 launchNbexec() {
     nbexec=`grep -v "^#" "$basedir"/etc/netbeans.clusters | grep -v "^$" | grep platform | while read X; do
         if expr "$X" : "/.*" >/dev/null; then
diff --git a/nb/ide.launcher/windows/nblauncher.cpp b/nb/ide.launcher/windows/nblauncher.cpp
index 37adb7097e..dda65af512 100644
--- a/nb/ide.launcher/windows/nblauncher.cpp
+++ b/nb/ide.launcher/windows/nblauncher.cpp
@@ -89,7 +89,6 @@ int NbLauncher::start(int argc, char *argv[]) {
     parseConfigFile((userDir + "\\etc\\" + getAppName() + ".conf").c_str());
     userDir = oldUserDir;
 
-    adjustHeapAndPermGenSize();
     addExtraClusters();
     string nbexecPath;
     SetDllDirectory(baseDir.c_str());
@@ -489,49 +488,6 @@ bool NbLauncher::parseConfigFile(const char* path) {
 
 typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
 
-bool NbLauncher::areWeOn32bits() {
-    // find out if we are on 32-bit Windows
-    SYSTEM_INFO siSysInfo;
-    PGNSI pGNSI;
-    pGNSI = (PGNSI) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
-            "GetNativeSystemInfo");
-    if (NULL != pGNSI)
-        pGNSI(&siSysInfo);
-    else
-        GetSystemInfo(&siSysInfo);
-    logMsg("NbLauncher::areWeOn32bits returns (0=false, 1=true)? %i", ((siSysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) ||
-            (strstr(NBEXEC_FILE_PATH, "64") == NULL)));
-    return ((siSysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) ||
-            (strstr(NBEXEC_FILE_PATH, "64") == NULL));
-}
-
-// Search if -Xmx and -XX:MaxPermSize are specified in existing arguments
-// If it isn't compute default values based on 32/64-bits and available RAM
-void NbLauncher::adjustHeapAndPermGenSize() {
-    if (nbOptions.find("-J-Xmx") == string::npos) {
-        int maxheap;
-        if (areWeOn32bits())
-            maxheap = 512;
-        else
-            maxheap = 1024;
-        // find how much memory we have and add -Xmx as 1/5 of the memory
-        MEMORYSTATUSEX ms;
-        ms.dwLength = sizeof (ms);
-        GlobalMemoryStatusEx(&ms);
-        int memory = (int)((ms.ullTotalPhys / 1024 / 1024) / 5);
-        if (memory < 96) {
-            memory = 96;
-        }
-        else if (memory > maxheap) {
-            memory = maxheap;
-        }
-        char tmp[32];
-        snprintf(tmp, 32, " -J-Xmx%dm", memory);
-        logMsg("Memory settings: -J-Xmx%dm", memory);
-        nbOptions += tmp;
-    }
-}
-
 const char * NbLauncher::getAppName() {
     return "netbeans";
 }
diff --git a/nb/ide.launcher/windows/nblauncher.h b/nb/ide.launcher/windows/nblauncher.h
index 591e65f33a..469a21f4fa 100644
--- a/nb/ide.launcher/windows/nblauncher.h
+++ b/nb/ide.launcher/windows/nblauncher.h
@@ -63,8 +63,6 @@ class NbLauncher {
 protected:
     virtual bool initBaseNames();
     virtual void addSpecificOptions(CmdArgs &args);
-    virtual bool areWeOn32bits();
-    virtual void adjustHeapAndPermGenSize();
     virtual bool findUserDir(const char *str);
     virtual bool findCacheDir(const char *str);
     virtual const char * getAppName();


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists