Skip to content

Commit b6e7d3a

Browse files
committed
Remove the min size limit from system pool for always_malloc
or it will cause huge memory waste
1 parent 729201d commit b6e7d3a

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/core/m-pools.c

+11-7
Original file line numberDiff line numberDiff line change
@@ -393,13 +393,17 @@ const REBPOOLSPEC Mem_Pool_Spec[MAX_POOLS] =
393393
memset(node, 0, length);
394394
} else {
395395
if (powerof2) {
396-
// !!! WHO added this and why??? Just use a left shift and mask!
397-
REBCNT len=2048;
398-
while(len<length)
399-
len*=2;
400-
length=len;
401-
} else
402-
length = ALIGN(length, 2048);
396+
REBCNT len=1;
397+
if (!always_malloc) {
398+
len = 2048;
399+
}
400+
// !!! WHO added this and why??? Just use a left shift and mask!
401+
while(len<length)
402+
len*=2;
403+
length=len;
404+
} else if (!always_malloc) {
405+
length = ALIGN(length, 2048);
406+
}
403407
#ifdef DEBUGGING
404408
Debug_Num("Alloc2:", length);
405409
#endif

0 commit comments

Comments
 (0)