plug leak: free shared type descrs recursively, as we ought to
This commit is contained in:
parent
d1b987d292
commit
6237368cc2
@ -1386,7 +1386,10 @@ fn make_free_glue(bcx: @block_ctxt, v: ValueRef, t: ty::t) {
|
||||
ty::ty_send_type. {
|
||||
// sendable type descriptors are basically unique pointers,
|
||||
// they must be freed.
|
||||
trans_shared_free(bcx, v)
|
||||
let ccx = bcx_ccx(bcx);
|
||||
let v = PointerCast(bcx, v, T_ptr(ccx.tydesc_type));
|
||||
Call(bcx, ccx.upcalls.free_shared_type_desc, [v]);
|
||||
bcx
|
||||
}
|
||||
ty::ty_native_fn(_, _) | ty::ty_fn(_) {
|
||||
trans_closure::make_fn_glue(bcx, v, t, free_ty)
|
||||
|
@ -736,6 +736,7 @@ fn make_opaque_cbox_free_glue(
|
||||
}
|
||||
|
||||
let ccx = bcx_ccx(bcx);
|
||||
let tcx = bcx_tcx(bcx);
|
||||
make_null_test(bcx, cbox) {|bcx|
|
||||
// Load the type descr found in the cbox
|
||||
let lltydescty = T_ptr(ccx.tydesc_type);
|
||||
@ -763,7 +764,7 @@ fn make_opaque_cbox_free_glue(
|
||||
trans_free_if_not_gc(bcx, cbox)
|
||||
}
|
||||
ty::closure_send. {
|
||||
let bcx = trans_shared_free(bcx, tydesc);
|
||||
let bcx = free_ty(bcx, tydesc, mk_tydesc_ty(tcx, ck));
|
||||
trans_shared_free(bcx, cbox)
|
||||
}
|
||||
}
|
||||
|
@ -293,7 +293,9 @@ void upcall_s_free_shared_type_desc(type_desc *td)
|
||||
|
||||
extern "C" CDECL void
|
||||
upcall_free_shared_type_desc(type_desc *td) {
|
||||
UPCALL_SWITCH_STACK(td, upcall_s_free_shared_type_desc);
|
||||
if (td) {
|
||||
UPCALL_SWITCH_STACK(td, upcall_s_free_shared_type_desc);
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -6,7 +6,7 @@ import std::comm::send;
|
||||
|
||||
fn main() { test05(); }
|
||||
|
||||
fn mk_counter<copy A>() -> sendfn(A) -> (A,uint) {
|
||||
fn mk_counter<A:copy>() -> sendfn(A) -> (A,uint) {
|
||||
// The only reason that the counter is generic is so that it closes
|
||||
// over both a type descriptor and some data.
|
||||
let v = [mutable 0u];
|
||||
|
Loading…
x
Reference in New Issue
Block a user