Skip to content

Commit

Permalink
Shorten the nursery when creating large bigints
Browse files Browse the repository at this point in the history
A bigint takes only very little space in the nursery, but it can hold
onto a large buffer. When creating a bigint that's larger than a native,
decrease the nursery_alloc_limit if possible. The decreased nursery
means a garbage collection will happen sooner, cleaning up any unused
bigints and their buffers.

An initial stab at MoarVM issue #545 and RT #126450.
  • Loading branch information
MasterDuke17 committed Mar 14, 2017
1 parent d7caeba commit 53601c8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/math/bigintops.c
Expand Up @@ -359,6 +359,11 @@ MVMObject * MVM_bigint_##opname(MVMThreadContext *tc, MVMObject *result_type, MV
mp_##opname(ia, ib, ic); \
store_bigint_result(bc, ic); \
clear_temp_bigints(tmp, 2); \
/*if (mp_count_bits(ic) > 65 && \
((tc->nursery_alloc_limit - sizeof(mp_int)) > (tc->nursery_alloc + sizeof(mp_int)))) \
{ \
tc->nursery_alloc_limit -= sizeof(mp_int); \
}*/ \
} \
else { \
MVMint64 sc; \
Expand Down

0 comments on commit 53601c8

Please sign in to comment.