Brian Slesinsky has uploaded a new change for review.

  https://gwt-review.googlesource.com/1870


Change subject: Clear the GWT bridge to reduce severity of memory leaks. This allows data held by generators to be freed. (Also, reduces the number of red herrings when tracking down a memory leak.)
......................................................................

Clear the GWT bridge to reduce severity of memory leaks.
This allows data held by generators to be freed.
(Also, reduces the number of red herrings when tracking
down a memory leak.)

Change-Id: I17886328c4c41c3e58271b8b4c8fde2e2bf689d0
---
M dev/core/src/com/google/gwt/dev/shell/CompilingClassLoader.java
1 file changed, 14 insertions(+), 12 deletions(-)



diff --git a/dev/core/src/com/google/gwt/dev/shell/CompilingClassLoader.java b/dev/core/src/com/google/gwt/dev/shell/CompilingClassLoader.java
index dd13008..13b263f 100644
--- a/dev/core/src/com/google/gwt/dev/shell/CompilingClassLoader.java
+++ b/dev/core/src/com/google/gwt/dev/shell/CompilingClassLoader.java
@@ -1159,7 +1159,7 @@

       if (className.equals("com.google.gwt.core.client.GWT")) {
         gwtClass = newClass;
-        updateGwtClass();
+        setGwtBridge(makeGwtBridge());
       }

       return newClass;
@@ -1212,6 +1212,7 @@
     weakJsoCache.clear();
     weakJavaWrapperCache.clear();
     dispClassInfoOracle.clear();
+    setGwtBridge(null);
   }

   /**
@@ -1396,23 +1397,14 @@
   }

   /**
- * Tricky one, this. Reaches over into this modules's JavaScriptHost class and
-   * sets its static 'host' field to our module space.
-   *
-   * @see JavaScriptHost
+ * Calls setBridge method on the GWT class inside this classloader, if possible.
    */
-  private void updateGwtClass() {
+  private void setGwtBridge(GWTBridgeImpl bridge) {
     if (gwtClass == null) {
       return;
     }
     Throwable caught;
     try {
-      GWTBridgeImpl bridge;
-      if (shellJavaScriptHost == null) {
-        bridge = null;
-      } else {
-        bridge = new GWTBridgeImpl(shellJavaScriptHost);
-      }
       final Class<?>[] paramTypes = new Class[]{GWTBridge.class};
       Method setBridgeMethod = gwtClass.getDeclaredMethod("setBridge",
           paramTypes);
@@ -1434,6 +1426,16 @@
   }

   /**
+   * Returns a new bridge or null.
+   */
+  private GWTBridgeImpl makeGwtBridge() {
+    if (shellJavaScriptHost == null) {
+      return null;
+    }
+    return new GWTBridgeImpl(shellJavaScriptHost);
+  }
+
+  /**
* Tricky one, this. Reaches over into this modules's JavaScriptHost class and
    * sets its static 'host' field to our module space.
    *

--
To view, visit https://gwt-review.googlesource.com/1870
To unsubscribe, visit https://gwt-review.googlesource.com/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I17886328c4c41c3e58271b8b4c8fde2e2bf689d0
Gerrit-PatchSet: 1
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Brian Slesinsky <skybr...@google.com>

--
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- You received this message because you are subscribed to the Google Groups "Google Web Toolkit Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to