diff options
author | Russ Cox <rsc@golang.org> | 2009-03-20 16:34:13 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-03-20 16:34:13 -0700 |
commit | aa63fd67d59b14fef1795ee074a45c8e8935a0ee (patch) | |
tree | 491e3743300c535d52e605d1a60887610272009f | |
parent | 56d6ef49ebdd6d7f03e8dcaeadc1573f99493487 (diff) | |
download | golang-aa63fd67d59b14fef1795ee074a45c8e8935a0ee.tar.gz |
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
-rw-r--r-- | src/runtime/malloc.h | 2 | ||||
-rw-r--r-- | src/runtime/msize.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/malloc.h b/src/runtime/malloc.h index d1d9e95e9..530dfc98f 100644 --- a/src/runtime/malloc.h +++ b/src/runtime/malloc.h @@ -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 diff --git a/src/runtime/msize.c b/src/runtime/msize.c index 62d5c3ad9..25e22637d 100644 --- a/src/runtime/msize.c +++ b/src/runtime/msize.c @@ -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; |