mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 08:34:33 +00:00
conditionally leak memory
This commit is contained in:
parent
5d22b6a9cf
commit
5548bf136d
6 changed files with 372 additions and 7 deletions
|
@ -44,6 +44,7 @@ pub struct Env<'a, 'ctx, 'env> {
|
|||
pub module: &'ctx Module<'ctx>,
|
||||
pub interns: Interns,
|
||||
pub ptr_bytes: u32,
|
||||
pub leak: bool,
|
||||
}
|
||||
|
||||
impl<'a, 'ctx, 'env> Env<'a, 'ctx, 'env> {
|
||||
|
@ -798,8 +799,10 @@ fn decrement_refcount_list<'a, 'ctx, 'env>(
|
|||
|
||||
// refcount is one, and will be decremented. This list can be freed
|
||||
let build_else = || {
|
||||
let free = builder.build_free(refcount_ptr);
|
||||
builder.insert_instruction(&free, None);
|
||||
if !env.leak {
|
||||
let free = builder.build_free(refcount_ptr);
|
||||
builder.insert_instruction(&free, None);
|
||||
}
|
||||
|
||||
body
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue