Memory leak after turning off plugin

Steps to reproduce

Use this simplest plugin, it has a huge array data(abort 40M), doing nothing but adding a ribbon icon:

const { Plugin } = require("obsidian")
module.exports = class Simplest extends Plugin {
    async onload() {
            "Simplest do nothing",
            (evt) => {
        // this plugin has a lot of data
        this.big = Array(10000000).map(_ => "May the world peaceful")
    async onunload() {

    doNothing() { }
  1. Open devtools → Memory,jsheap of is about 15M
  2. Turn on this plugin,jsheap size raises to ~50M
  3. Close this plugin,and click garbage collection button on left-top of Memory panel

Expected result

As plugin has been turned off, all memory should be able to clean up,js heap should reduce to ~15M

Actual result

Memory is still ~50M


  • Operating system: win10 21H2
  • Obsidian version:1.0.3 / 1.0.3
  • Debug info:

Additional information

This memory leak is related to app.workspace.leftRibbon.orderedRibbonActions。After turning of plugin, there is a registered entry inside this array. An entry contains a callback function , which may contains the this pointer to plugin.

If assign null to app.workspace.leftRibbon.orderedRibbonActions and do garbage collection again, heap size will return to ~15M.

will be fixed v1.1

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.