Skip to content

Commit

Permalink
Avoid moving alloc'd value in GC
Browse files Browse the repository at this point in the history
  • Loading branch information
jakub-gonet committed Oct 23, 2024
1 parent 22e915f commit 9dc7498
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libAtomVM/nifs.c
Original file line number Diff line number Diff line change
Expand Up @@ -3523,7 +3523,7 @@ static term nif_erlang_fun_info_2(Context *ctx, int argc, term argv[])
AVM_ABORT();
}

if (UNLIKELY(memory_ensure_free_opt(ctx, TUPLE_SIZE(2), MEMORY_CAN_SHRINK) != MEMORY_GC_OK)) {
if (UNLIKELY(memory_ensure_free_with_roots(ctx, TUPLE_SIZE(2), 1, &value, MEMORY_CAN_SHRINK) != MEMORY_GC_OK)) {
RAISE_ERROR(OUT_OF_MEMORY_ATOM);
}
term fun_info_tuple = term_alloc_tuple(2, &ctx->heap);
Expand Down

0 comments on commit 9dc7498

Please sign in to comment.