summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-02-27 19:11:12 +0000
committerNicholas Clark <nick@ccl4.org>2008-02-27 19:11:12 +0000
commitd8fca4022b56f335fb492e336b5d155376eb1bf7 (patch)
tree5782cd9ec92f2203934b6f0f38f71916e4e1e90d /hv.c
parent641071807211a3969bcad26ac3f2a39f4550a11c (diff)
downloadperl-d8fca4022b56f335fb492e336b5d155376eb1bf7.tar.gz
Use malloc_good_size() to round up the size of requested arenas to the
size that will actually be allocated, to squeeze last few bytes into use. p4raw-id: //depot/perl@33390
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/hv.c b/hv.c
index a532b146c2..f85fad315a 100644
--- a/hv.c
+++ b/hv.c
@@ -40,8 +40,11 @@ STATIC void
S_more_he(pTHX)
{
dVAR;
- HE* he = (HE*) Perl_get_arena(aTHX_ PERL_ARENA_SIZE, HE_SVSLOT);
- HE * const heend = &he[PERL_ARENA_SIZE / sizeof(HE) - 1];
+ /* We could generate this at compile time via (another) auxiliary C
+ program? */
+ const size_t arena_size = Perl_malloc_good_size(PERL_ARENA_SIZE);
+ HE* he = (HE*) Perl_get_arena(aTHX_ arena_size, HE_SVSLOT);
+ HE * const heend = &he[arena_size / sizeof(HE) - 1];
PL_body_roots[HE_SVSLOT] = he;
while (he < heend) {