mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 23:31:12 +00:00
memory leak investigation
This commit is contained in:
parent
82ff8a8edf
commit
0fdba3be56
2 changed files with 24 additions and 5 deletions
|
@ -127,7 +127,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let (defs, scope1, output, symbols_introduced) = canonicalize_defs(
|
let (defs, _scope, output, symbols_introduced) = canonicalize_defs(
|
||||||
&mut env,
|
&mut env,
|
||||||
Output::default(),
|
Output::default(),
|
||||||
var_store,
|
var_store,
|
||||||
|
|
|
@ -2245,11 +2245,30 @@ pub fn build_exp_stmt<'a, 'ctx, 'env>(
|
||||||
let (value, layout) = load_symbol_and_layout(scope, symbol);
|
let (value, layout) = load_symbol_and_layout(scope, symbol);
|
||||||
|
|
||||||
if layout.is_refcounted() {
|
if layout.is_refcounted() {
|
||||||
if value.is_pointer_value() {
|
match value {
|
||||||
let value_ptr = value.into_pointer_value();
|
BasicValueEnum::PointerValue(value_ptr) => {
|
||||||
let refcount_ptr = PointerToRefcount::from_ptr_to_data(env, value_ptr);
|
let refcount_ptr =
|
||||||
|
PointerToRefcount::from_ptr_to_data(env, value_ptr);
|
||||||
refcount_ptr.decrement(env, layout);
|
refcount_ptr.decrement(env, layout);
|
||||||
}
|
}
|
||||||
|
BasicValueEnum::StructValue(_value_struct) => {
|
||||||
|
match layout {
|
||||||
|
Layout::Builtin(Builtin::Str)
|
||||||
|
| Layout::Builtin(Builtin::List(_, _))
|
||||||
|
| Layout::Builtin(Builtin::Dict(_, _))
|
||||||
|
| Layout::Builtin(Builtin::Set(_)) => {
|
||||||
|
// let refcount_ptr = PointerToRefcount::from_list_wrapper(env, value_struct);
|
||||||
|
// refcount_ptr.decrement(env, layout);
|
||||||
|
eprintln!("we are likely leaking some memory, see #985 for details");
|
||||||
|
}
|
||||||
|
_ => unreachable!(
|
||||||
|
"decref on weird type, likely a closure? {:?}",
|
||||||
|
layout
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => unreachable!("cannot be decref'd"),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
build_exp_stmt(env, layout_ids, scope, parent, cont)
|
build_exp_stmt(env, layout_ids, scope, parent, cont)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue