A
Size: a a a
A
ВН
ВН
A
ВН
ВН
A
A
ВН
ВН
A
A
ВН
A
A
A
A
A
A
A
fn foo() {
let x: @int = @1024; // allocate space and initialize an int
// on the heap
bar(x); // pass it to bar
println(fmt!("%d", *x)); // print it on the screen
} // <-- the memory can be freed here
fn bar(x: @int) {
let y: @int = x; // make a new smart pointer to x
} // <-- despite y going out of scope, the memory is *not* freed her