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

Memory leak when declaring chans at the bottom of functions #729

Closed
eholk opened this issue Jul 22, 2011 · 3 comments
Closed

Memory leak when declaring chans at the bottom of functions #729

eholk opened this issue Jul 22, 2011 · 3 comments

Comments

@eholk
Copy link
Contributor

eholk commented Jul 22, 2011

The following program leaks c from main.

fn start(chan[chan[str]] c) {
    let port[str] p;

    p = port();
    c <| chan(p);
}

fn main() {
    let port[chan[str]] p = port();
    spawn start(chan(p));

    p |> c;
    auto c;
}

Interestingly, if you move the auto c; line above p |> c then the program works correctly.

@msullivan
Copy link
Contributor

A much simpler test case with the same failure is:

fn main() {
    x = @5;
    auto x;
}

I think the problem is that x is being zeroed out at "auto x".

@msullivan
Copy link
Contributor

(Well, actually the problem is that this is a valid program.)

@msullivan
Copy link
Contributor

marijn changed the scoping behavior so that these programs are no longer valid.

keeperofdakeys pushed a commit to keeperofdakeys/rust that referenced this issue Dec 12, 2017
Fix spelling of ptrace's request argument

Couldn't handle seeing this anymore after working on a ptrace API for `nix`!
bors pushed a commit to rust-lang-ci/rust that referenced this issue Oct 26, 2020
Update cranelift and use crates.io version of gimli
celinval added a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Add a fixme testcase that can be used to reproduce the issue rust-lang#729.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants