Skip to content

Plugin system memory leak (Arc<> over FFI) #261

Description

@tristanpoland

Intro

Arc<> is not at all FFI safe. Currently We have an issue in the plugin system where GPUI (WGPUI) unavoidably depends on Arc internally which cannot change.

The leak

  • On frame a plugin is told "render me a frame of your UI" where it returns a heavily nested data structure including Arc data internally.
  • This data is leaked across frames because when passed over FFI boundaries, the atomic counter disconnects creating a plugin-side and engine-side counter that never sync.

This means when the engine is done with the arc its atomic counter decrements, and so the memory deallocates. HOWEVER the plugin side counter is never updated and the memory is leaked on each render call.

Metadata

Metadata

Labels

CleanupbugSomething isn't workingenhancementNew feature or requesthelp wantedExtra attention is needed

Type

Projects

Status
Do Later/Low Priority

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions