// done lazily later.
buckets = nil;
} else {
- buckets = runtime·mallocgc(bucketsize << B, 0, FlagNoZero);
+ buckets = runtime·mallocgc(bucketsize << B, 0, FlagNoZero | FlagNoPointers);
+ // Note: the array really does have pointers, but we tell the gc about
+ // them explicitly via gciter below. We use FlagNoPointers to prevent
+ // the gc from scanning the bucket array itself. Fixes issue 6119.
for(i = 0; i < (uintptr)1 << B; i++) {
b = (Bucket*)(buckets + i * bucketsize);
clearbucket(b);
if((hash & newbit) == 0) {
if(xi == BUCKETSIZE) {
if(checkgc) mstats.next_gc = mstats.heap_alloc;
- newx = runtime·mallocgc(h->bucketsize, 0, FlagNoZero);
+ newx = runtime·mallocgc(h->bucketsize, 0, FlagNoZero | FlagNoPointers);
clearbucket(newx);
x->overflow = newx;
x = newx;
} else {
if(yi == BUCKETSIZE) {
if(checkgc) mstats.next_gc = mstats.heap_alloc;
- newy = runtime·mallocgc(h->bucketsize, 0, FlagNoZero);
+ newy = runtime·mallocgc(h->bucketsize, 0, FlagNoZero | FlagNoPointers);
clearbucket(newy);
y->overflow = newy;
y = newy;
old_buckets = h->buckets;
// NOTE: this could be a big malloc, but since we don't need zeroing it is probably fast.
if(checkgc) mstats.next_gc = mstats.heap_alloc;
- new_buckets = runtime·mallocgc((uintptr)h->bucketsize << (h->B + 1), 0, FlagNoZero);
+ new_buckets = runtime·mallocgc((uintptr)h->bucketsize << (h->B + 1), 0, FlagNoZero | FlagNoPointers);
flags = (h->flags & ~(Iterator | OldIterator));
if((h->flags & Iterator) != 0) {
flags |= OldIterator;
hash = h->hash0;
t->key->alg->hash(&hash, t->key->size, key);
if(h->buckets == nil) {
- h->buckets = runtime·mallocgc(h->bucketsize, 0, FlagNoZero);
+ h->buckets = runtime·mallocgc(h->bucketsize, 0, FlagNoZero | FlagNoPointers);
b = (Bucket*)(h->buckets);
clearbucket(b);
}
if(inserti == nil) {
// all current buckets are full, allocate a new one.
if(checkgc) mstats.next_gc = mstats.heap_alloc;
- newb = runtime·mallocgc(h->bucketsize, 0, FlagNoZero);
+ newb = runtime·mallocgc(h->bucketsize, 0, FlagNoZero | FlagNoPointers);
clearbucket(newb);
b->overflow = newb;
inserti = newb->tophash;