AvaloniaRider icon indicating copy to clipboard operation
AvaloniaRider copied to clipboard

Limit memory consumed by previewer in inactive tabs

Open ForNeVeR opened this issue 6 months ago • 0 comments

We have several reports in Rider with this:

Root 1:
[6.21K/  0%/ 406MB]  813MB          1   ROOT: Static field: java.awt.KeyboardFocusManager.currentFocusCycleRoot
[6.21K/  0%/ 406MB]  813MB          1   (root): com.intellij.openapi.fileEditor.impl.EditorCompositePanel
[5.75K/  0%/ 406MB]  813MB          1   parent: com.intellij.openapi.fileEditor.impl.EditorTabs
[  127/  0%/ 405MB]  812MB          1   visibleInfos: java.util.ArrayList
[  127/  0%/ 405MB]  812MB          1   elementData: java.lang.Object[]
[  127/  0%/ 405MB]  812MB         29   []: com.intellij.ui.tabs.TabInfo
[   70/  0%/ 405MB]  812MB         24   component: com.intellij.openapi.fileEditor.impl.EditorCompositePanel
[   50/  0%/ 405MB]  812MB          9   focusComponent: com.intellij.openapi.fileEditor.impl.EditorComposite$$Lambda+0x0000029e2281d9b0
[   50/  0%/ 405MB]  812MB          9   arg$1: com.jetbrains.rider.xaml.splitEditor.XamlSplitEditorImpl
[   50/  0%/ 405MB]  812MB          9   previewEditor: me.fornever.avaloniarider.idea.editor.AvaloniaRemotePreviewEditor
[    7/  0%/ 405MB]  811MB          7   editorComponent: me.fornever.avaloniarider.idea.editor.BitmapPreviewEditorComponent
[    7/  0%/ 405MB]  811MB          7   frameBufferView: kotlin.SynchronizedLazyImpl!1
[    7/  0%/ 405MB]  811MB          7   _value: me.fornever.avaloniarider.idea.editor.PreviewImageView
[    7/  0%/ 405MB]  405MB          7   lastFrame: me.fornever.avaloniarider.controlmessages.FrameMessage
[    7/  0%/ 405MB]  405MB          7 * data: byte[]

So, there seems to be 800/400 MiB consumed by the bitmaps in memory!

We should do something about that.

Either some adaptive caching strategy, or backing these to file buffers when inactive, or something else.

ForNeVeR avatar Jul 04 '25 12:07 ForNeVeR