-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a memory leak with command modules (#2017)
This commit fixes a memory leak that can happen with `Linker::module` when the provided module is a command. This function creates a closure but the closure closed over a strong reference to `Store` (and transitively through any imports provided). Unfortunately a `Store` keeps everything alive, including `Func`, so this meant that `Store` was inserted into a cycle which caused the leak. The cycle here is manually broken by closing over the raw value of each external value rather than the external value itself (which has a strong reference to `Store`).
- Loading branch information
1 parent
23b8c6b
commit cb7b1aa
Showing
4 changed files
with
123 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters