|
| 1 | +# Plugin Classes to Check in HPROF Analysis |
| 2 | + |
| 3 | +This document lists all plugin classes to search for when analyzing heap dumps to identify memory leaks after plugin |
| 4 | +unload. All classes should have **count = 0** after successful plugin unload. |
| 5 | + |
| 6 | +## Services |
| 7 | + |
| 8 | +*Expected: 1 instance per project, or 0 after unload* |
| 9 | + |
| 10 | +- `service.ViewService` |
| 11 | +- `service.ToolWindowService` |
| 12 | +- `service.ToolWindowServiceInterface` *(interface - unlikely to leak but check if implemented by plugin classes)* |
| 13 | +- `service.StatusBarService` |
| 14 | +- `service.GitService` |
| 15 | +- `service.TargetBranchService` |
| 16 | +- `implementation.compare.ChangesService` |
| 17 | + |
| 18 | +## State/Persistence |
| 19 | + |
| 20 | +- `state.State` |
| 21 | +- `state.MyModelConverter` |
| 22 | +- `state.WindowPositionTracker` |
| 23 | + |
| 24 | +## Listeners |
| 25 | + |
| 26 | +*Expected: 0 after unload* |
| 27 | + |
| 28 | +- `listener.MyBulkFileListener` |
| 29 | +- `listener.MyDynamicPluginListener` |
| 30 | +- `listener.MyToolWindowListener` |
| 31 | +- `listener.VcsStartup` |
| 32 | +- `listener.MyChangeListListener` |
| 33 | +- `listener.MyGitRepositoryChangeListener` |
| 34 | +- `listener.MyFileEditorManagerListener` |
| 35 | +- `listener.MyTabContentListener` |
| 36 | +- `listener.MyTreeSelectionListener` |
| 37 | +- `listener.ToggleHeadAction` |
| 38 | +- `listener.VcsContextMenuAction` |
| 39 | + |
| 40 | +## UI Components |
| 41 | + |
| 42 | +### Main Components |
| 43 | + |
| 44 | +- `toolwindow.ToolWindowView` |
| 45 | +- `toolwindow.ToolWindowUIFactory` |
| 46 | +- `toolwindow.BranchSelectView` |
| 47 | +- `toolwindow.TabOperations` |
| 48 | +- `toolwindow.VcsTreeActions` |
| 49 | + |
| 50 | +#### Actions |
| 51 | +- `toolwindow.actions.TabMoveActions` |
| 52 | +- `toolwindow.actions.TabMoveActions$MoveTabLeft` |
| 53 | +- `toolwindow.actions.TabMoveActions$MoveTabRight` |
| 54 | +- `toolwindow.actions.RenameTabAction` |
| 55 | +- `toolwindow.actions.ResetTabNameAction` |
| 56 | + |
| 57 | +### UI Elements |
| 58 | + |
| 59 | +- `toolwindow.elements.VcsTree` |
| 60 | +- `toolwindow.elements.BranchTree` |
| 61 | +- `toolwindow.elements.BranchTreeEntry` |
| 62 | +- `toolwindow.elements.MySimpleChangesBrowser` |
| 63 | +- `toolwindow.elements.CurrentBranch` |
| 64 | +- `toolwindow.elements.TargetBranch` |
| 65 | + |
| 66 | +## Status Bar |
| 67 | + |
| 68 | +- `statusBar.MyStatusBarWidget` |
| 69 | +- `statusBar.MyStatusBarWidgetFactory` |
| 70 | +- `statusBar.MyStatusBarPanel` |
| 71 | + |
| 72 | +## Models |
| 73 | + |
| 74 | +- `model.MyModel` |
| 75 | +- `model.MyModel$field` *(enum - check for RxJava subscription leaks)* |
| 76 | +- `model.MyModelBase` |
| 77 | +- `model.TargetBranchMap` |
| 78 | +- `model.Debounce` |
| 79 | + |
| 80 | +## Implementation Classes |
| 81 | + |
| 82 | +### Line Status Tracker |
| 83 | + |
| 84 | +- `implementation.lineStatusTracker.MyLineStatusTrackerImpl` |
| 85 | +- `implementation.lineStatusTracker.CommitDiffWorkaround` |
| 86 | + |
| 87 | +### Scope |
| 88 | + |
| 89 | +- `implementation.scope.MyScope` |
| 90 | +- `implementation.scope.MyPackageSet` *(registered with NamedScopeManager - critical leak if not unregistered)* |
| 91 | +- `implementation.scope.MyScopeInTarget` |
| 92 | +- `implementation.scope.MyScopeNameSupplier` |
| 93 | + |
| 94 | +### File Status |
| 95 | + |
| 96 | +- `implementation.fileStatus.GitScopeFileStatusProvider` |
| 97 | + |
| 98 | +## Utility Classes |
| 99 | + |
| 100 | +- `utils.CustomRollback` |
| 101 | +- `utils.GitCommitReflection` |
| 102 | +- `utils.GitUtil` |
| 103 | +- `utils.Notification` |
| 104 | +- `system.Defs` |
| 105 | + |
| 106 | +## Anonymous/Inner Classes to Look For |
| 107 | + |
| 108 | +*These are patterns - search for classes matching these names:* |
| 109 | + |
| 110 | +- `TabOperations$1` *(rename action)* |
| 111 | +- `TabOperations$2` *(reset action)* |
| 112 | +- `TabOperations$3` *(move left action)* |
| 113 | +- `TabOperations$4` *(move right action)* |
| 114 | +- `VcsTree$$Lambda` *(any lambda from VcsTree)* |
| 115 | +- `MyLineStatusTrackerImpl$1` *(BaseRevisionSwitcher anonymous inner class - circular reference)* |
| 116 | +- `MyLineStatusTrackerImpl$$Lambda` *(lambdas from line status tracker)* |
| 117 | +- `MySimpleChangesBrowser$1` *(anonymous MouseAdapter)* |
| 118 | +- `BranchTree$MyColoredTreeCellRenderer` |
| 119 | +- Any class ending with `$$Lambda$...` |
| 120 | + |
| 121 | +--- |
| 122 | + |
| 123 | +## How to Search Efficiently |
| 124 | + |
| 125 | +### 1. Search by Package Prefix |
| 126 | + |
| 127 | +Filter the HPROF classes view using these prefixes: |
| 128 | + |
| 129 | +- `service.` |
| 130 | +- `listener.` |
| 131 | +- `toolwindow.` |
| 132 | +- `implementation.` |
| 133 | +- `model.` |
| 134 | +- `state.` |
| 135 | +- `statusBar.` |
| 136 | +- `utils.` |
| 137 | + |
| 138 | +### 2. Filter the Classes View |
| 139 | + |
| 140 | +1. Sort by "Count" column |
| 141 | +2. Look for `count != 0` |
| 142 | +3. Focus on YOUR packages (ignore `com.intellij.*`, `java.*`, `kotlin.*`) |
| 143 | + |
| 144 | +### 3. Priority Classes to Check |
| 145 | + |
| 146 | +*Most likely to leak:* |
| 147 | + |
| 148 | +1. **All listeners** - Must be unregistered |
| 149 | +2. **TabOperations and its anonymous classes** - Actions must be unregistered |
| 150 | +3. **ToolWindowView** - UI components must be disposed |
| 151 | +4. **ViewService** - RxJava subscriptions must be disposed |
| 152 | +5. **MyLineStatusTrackerImpl** - Background tasks must be cancelled |
| 153 | +6. **Any class with `$` in the name** - Anonymous/inner classes often capture outer references |
| 154 | + |
| 155 | +--- |
| 156 | + |
| 157 | +## Analysis Steps |
| 158 | + |
| 159 | +1. Open the `.hprof` file in IntelliJ's memory profiler |
| 160 | +2. Navigate to the "Classes" view |
| 161 | +3. Sort by "Count" column in descending order |
| 162 | +4. Search for each class using the package prefixes above |
| 163 | +5. **Report back any classes with `count != 0`** and we'll fix them! |
0 commit comments