// setup for mark sweep
runtime·markspan(v, 0, 0, true);
}
+
+ if (sizeof(void*) == 4 && c->local_total_alloc >= (1<<30)) {
+ // purge cache stats to prevent overflow
+ runtime·lock(&runtime·mheap);
+ runtime·purgecachedstats(m);
+ runtime·unlock(&runtime·mheap);
+ }
+
if(!(flag & FlagNoGC))
runtime·markallocated(v, size, (flag&FlagNoPointers) != 0);
MSpan *s;
m->mcache->local_nlookup++;
+ if (sizeof(void*) == 4 && m->mcache->local_nlookup >= (1<<30)) {
+ // purge cache stats to prevent overflow
+ runtime·lock(&runtime·mheap);
+ runtime·purgecachedstats(m);
+ runtime·unlock(&runtime·mheap);
+ }
+
s = runtime·MHeap_LookupMaybe(&runtime·mheap, v);
if(sp)
*sp = s;
struct MCache
{
MCacheList list[NumSizeClasses];
- uint64 size;
- int64 local_cachealloc; // bytes allocated (or freed) from cache since last lock of heap
- int64 local_objects; // objects allocated (or freed) from cache since last lock of heap
- int64 local_alloc; // bytes allocated (or freed) since last lock of heap
- int64 local_total_alloc; // bytes allocated (even if freed) since last lock of heap
- int64 local_nmalloc; // number of mallocs since last lock of heap
- int64 local_nfree; // number of frees since last lock of heap
- int64 local_nlookup; // number of pointer lookups since last lock of heap
+ uintptr size;
+ intptr local_cachealloc; // bytes allocated (or freed) from cache since last lock of heap
+ intptr local_objects; // objects allocated (or freed) from cache since last lock of heap
+ intptr local_alloc; // bytes allocated (or freed) since last lock of heap
+ uintptr local_total_alloc; // bytes allocated (even if freed) since last lock of heap
+ uintptr local_nmalloc; // number of mallocs since last lock of heap
+ uintptr local_nfree; // number of frees since last lock of heap
+ uintptr local_nlookup; // number of pointer lookups since last lock of heap
int32 next_sample; // trigger heap sample after allocating this many bytes
// Statistics about allocation size classes since last lock of heap
struct {
- int64 nmalloc;
- int64 nfree;
+ uintptr nmalloc;
+ uintptr nfree;
} local_by_size[NumSizeClasses];
};