jdic
  1. jdic
  2. JDIC-502

Memory leak: WebBrowser references not released by NativeEventThread

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: current
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      502

      Description

      After a WebBrowser is disposed, NativeEventThread still keeps a reference to
      the WebBrowser instance preventing it to be garbage collected, in fact the
      whole parent window can't be garbage collected unless the WebBrowser is removed
      from its parent.
      Tested only in Windows but it should happen in all platforms.
      The reference is in webBrowsers vector. The webbrowser is added in
      NativeEventThread.attachWebBrowser method and is never removed.
      So also the memory used by the webBrowsers vector is increasing as more
      instances are being created and disposed, which is also a memory leak.
      Possible solution would be to change vector to map and remove from map with
      Integer as keys and IWebBrowser as values, and removed from map after dispose.

        Activity

        Hide
        dkuy added a comment -

        Created an attachment (id=303)
        Shows how the webbrowser instances are not gc while buttons are even after calling several times System.gc() and Runtime.getRuntime().runFinalization(). Also in debugger can be seen that thread with name EventThread is holding a vector variable called webBrowsers with the 20 elements, which prevents them from being garbage collected

        Show
        dkuy added a comment - Created an attachment (id=303) Shows how the webbrowser instances are not gc while buttons are even after calling several times System.gc() and Runtime.getRuntime().runFinalization(). Also in debugger can be seen that thread with name EventThread is holding a vector variable called webBrowsers with the 20 elements, which prevents them from being garbage collected

          People

          • Assignee:
            michael_shan
            Reporter:
            dkuy
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: