Memory leak on autosave if "Unlinked mentions" expanded in Outgoing Links

Steps to reproduce

  1. Create a file with a significant amount of placeholder text.
  2. Create a bunch of files each named with a word in the large file. (To amplify the problem, make folders with copies of the word files.)
  3. In the “Outgoing links” view, expand the “Unlinked mentions” header. (The view doesn’t need to be visible after this.)
  4. Open the large file, make a minor edit, then wait a second for autosave to kick in. Repeat a bunch of times.

A prepared MRE vault is attached that completes steps 1-3.

Did you follow the troubleshooting guide? [Y/N]


Expected result

While it may be higher due to all the references, the render thread’s memory usage remains stable across autosaves.

Actual result

Depending on the amount of unlinked mentions, the render thread leaks some memory on every autosave. This can quickly add up and invoke the OOM killer. (In my case that spurred me to investigate this, this was ~80MB each time. This adds up to gigabytes in just a few minutes.) When the render thread is killed, the window freezes, requiring a reopen.


From the MRE vault:

	Obsidian version: v1.4.14
	Installer version: v1.4.14
	Operating system: #1 SMP PREEMPT_DYNAMIC Thu Aug 4 20:55:20 UTC 2022 5.18.16-surface
	Login status: not logged in
	Insider build toggle: off
	Live preview: on
	Legacy editor: off
	Base theme: dark
	Community theme: none
	Snippets enabled: 0
	Restricted mode: on


Additional information

Minimal Reproducible Example vault

Memleak (36.4 KB)

GIF demonstrating leak

Peek 2023-10-10 18-04

Console while leaking MRE vault until render thread is killed

$ obsidian
2023-10-10 21:32:54 Loading main app package /opt/Obsidian/resources/obsidian.asar
Updates disabled.
xdg-settings: default-url-scheme-handler not implemented for xfce
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0

sendToFrame() failed: Error: Render frame was disposed before WebFrameMain could be accessed
Attempting to call a function in a renderer window that has been closed or released.
Function provided here: app.js:1:1278424
Remote event names: blur, focus


The backlinks plugin could have a similar leak, but I haven’t tested this.


Thanks I’ll check this.

thank you very much for the detailed report. It should be fixed in v1.5.2

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