1
0
mirror of https://github.com/golang/go synced 2024-11-26 00:07:57 -07:00

embarassing bug in allocator:

was applying wrong waste check,
resulting in many more size classes
than necessary.

R=r
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=26602
CL=26605
This commit is contained in:
Russ Cox 2009-03-20 16:34:13 -07:00
parent 90943c8ee4
commit c1e748bd2e
2 changed files with 2 additions and 2 deletions

View File

@ -91,7 +91,7 @@ typedef uintptr PageID; // address >> PageShift
enum
{
// Tunable constants.
NumSizeClasses = 150, // Number of size classes (must match msize.c)
NumSizeClasses = 67, // Number of size classes (must match msize.c)
MaxSmallSize = 32<<10,
FixAllocChunk = 128<<10, // Chunk size for FixAlloc

View File

@ -82,7 +82,7 @@ InitSizes(void)
// so wasted space is at most 12.5%.
allocsize = PageSize;
osize = size + RefcountOverhead;
while(allocsize%osize > (PageSize/8))
while(allocsize%osize > (allocsize/8))
allocsize += PageSize;
npages = allocsize >> PageShift;