Skip to content

Instantly share code, notes, and snippets.

@nikomatsakis
Created March 14, 2012 21:50
Show Gist options
  • Save nikomatsakis/2039794 to your computer and use it in GitHub Desktop.
Save nikomatsakis/2039794 to your computer and use it in GitHub Desktop.
fn foo() -> @memory_pool {
// let the region for this block be "r_foo"
let p: @memory_pool = pool();
let x: &r_foo.T = new(p) T;
ret p; // x cannot be returned because r_foo is not in scope
}
fn bar() {
let p = foo(); // memory for p is not yet freed...
// ...but I can't access the prior contents.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment