//go:build gc.leaking && alloc_trace package runtime import "unsafe" const maxAllocSites = 8192 var allocCounters [maxAllocSites]uint64 var numAllocSites int32 //go:noinline func logAlloc(siteID int32) { if siteID >= 0 && siteID < maxAllocSites { allocCounters[siteID]++ if siteID >= numAllocSites { numAllocSites = siteID + 1 } } } //go:export __moxie_alloc_counters_ptr func allocCountersPtr() uintptr { return uintptr(unsafe.Pointer(&allocCounters[0])) } //go:export __moxie_alloc_n_sites func allocNSites() int32 { return numAllocSites } //go:export __moxie_total_alloc func totalAlloc() uint64 { return gcTotalAlloc } //go:export __moxie_mallocs func mallocs() uint64 { return gcMallocs } //go:export __moxie_heap_ptr func heapPtr() uintptr { return heapptr }