Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a memory leak with command modules #2017

Merged
merged 1 commit into from
Feb 1, 2021

Commits on Feb 1, 2021

  1. Fix a memory leak with command modules

    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`).
    alexcrichton committed Feb 1, 2021
    Configuration menu
    Copy the full SHA
    93a7e81 View commit details
    Browse the repository at this point in the history