AtomMaterialUI / material-theme-issues

Issues Repository for the Material Theme UI plugin for JetBrains
Other
61 stars 4 forks source link

[Bug]: com.mallowigi.idea.ui.OverlayPainter retains disposed Projects #432

Closed ViugiNick closed 6 months ago

ViugiNick commented 9 months ago

Describe the bug

com.mallowigi.idea.ui.OverlayPainter retains disposed ProjectImpls and DockableEditorTabbedContainerss.

 97.8M        1 ROOT: Static field: com.mallowigi.idea.ui.OverlayPainter.instance$delegate
 97.8M        1 (root): kotlin.SynchronizedLazyImpl!1
 97.8M        1 _value: com.mallowigi.idea.ui.OverlayPainter
 97.8M        1 rootPanes: java.util.ArrayList
 97.8M        1 elementData: java.lang.Object[]
 97.8M        4 []: com.intellij.openapi.wm.impl.IdeRootPane
 71.8M        4 navBarStatusWidgetComponent: com.intellij.ide.navigationToolbar.NavBarContainer
 71.8M        4 panel: com.intellij.ide.navigationToolbar.MyNavBarWrapperPanel
 71.7M        4 myProject: com.intellij.openapi.project.impl.ProjectImpl (disposed) 
     131MB/1 objects          (root): java.lang.Class(com.intellij.openapi.progress.impl.ProgressSuspender)
     131MB/1 objects          (static): com.intellij.openapi.application.impl.ApplicationImpl
    76.6MB/1 objects          +-serviceInstanceHotCache: java.util.concurrent.ConcurrentHashMap
    76.6MB/1 objects          | table: [Ljava.util.concurrent.ConcurrentHashMap$Node;
    54.4MB/1 objects          \-componentKeyToAdapter: java.util.concurrent.ConcurrentHashMap
    54.4MB/1 objects            table: [Ljava.util.concurrent.ConcurrentHashMap$Node;
    48.6MB/3 objects            []: java.util.concurrent.ConcurrentHashMap$Node
    47.3MB/2 objects            val: com.intellij.serviceContainer.LightServiceComponentAdapter
    46.8MB/1 objects            initializedInstance: com.mallowigi.idea.ui.OverlayPainter
    46.8MB/1 objects            rootPanes: java.util.HashSet
    46.8MB/1 objects            map: java.util.HashMap
    46.8MB/1 objects            table: [Ljava.util.HashMap$Node;
   46.6MB/29 objects            []: java.util.HashMap$Node
   30.6MB/27 objects            +-key: javax.swing.JRootPane
   28.9MB/18 objects            | contentPane: javax.swing.JPanel
   28.9MB/18 objects            | hierarchyListener: com.intellij.util.ui.update.UiNotifyConnector
   28.9MB/18 objects            | myTarget: com.intellij.openapi.fileEditor.impl.DockableEditorTabbedContainer(disposed)

To Reproduce

Unfortunately we don't have exact steps to reproduce the issue, the bug is based on memory usage reports

Expected behavior

No memory leaks

Material Theme Version

no data

IDE

Android Studio

System Info

Android Studio Iguana | 2023.2.1 Canary 14
Mac OS X

Logs/Screenshots

No response

mgroth0 commented 6 months ago

I came to report the same issue.

My plugin is dynamic and normally unloads without issue.

But sometimes my plugin fails to unload and in the memory snapshot I see:

2024-02-11 15:14:07,829 [55421708]   INFO - #c.i.i.p.DynamicPlugins - Snapshot analysis result: Root 1:
  ROOT: Sticky class.
  java.lang.Class.(root): 
  sun.lwawt.macosx.LWCToolkit.enumConstantDirectory: 
  java.util.WeakHashMap.listener2SelectiveListener: 
  java.util.WeakHashMap$Entry[].table: 
  java.util.WeakHashMap$Entry.[]: 
  java.awt.Toolkit$SelectiveAWTEventListener.value: 
  com.mallowigi.idea.ui.OverlayPainter.listener: 
  java.util.HashSet.rootPanes: 
  java.util.HashMap.map: 
  java.util.HashMap$Node[].table: 
  java.util.HashMap$Node.[]: 
  com.intellij.openapi.wm.impl.IdeRootPane.key: 
  com.intellij.toolWindow.ToolWindowPane.toolWindowPane: 
  com.intellij.toolWindow.ToolWindowPaneNewButtonManager.buttonManager: 
  com.intellij.toolWindow.ToolWindowRightToolbar.right: 
  com.intellij.toolWindow.ToolWindowToolbar$StripeV2.bottomStripe: 
  java.util.ArrayList.buttons: 
  java.lang.Object[].elementData: 
  com.intellij.toolWindow.ToolWindowPaneNewButtonManager$createStripeButton$manager$1.[]: 
  com.intellij.openapi.wm.impl.ToolWindowImpl.$toolWindow: 
  matt.idea.main.extensions.toolwin.MyToolWindowContentFactory.contentFactory: 
  java.lang.Class.<class>: 
* com.intellij.ide.plugins.cl.PluginClassLoader.annotationType: 

Note that com.mallowigi.idea.ui.OverlayPainter.listener is in there. I don't have any understanding about this, but I'm sure that it is the same issue.

I am not sure how to reproduce it. Sometimes this happens, sometimes it doesn't.

Using Material Theme UI version 8.13.2