func mProf_Malloc(p unsafe.Pointer, size uintptr) {
	var stk [maxStack]uintptr
	nstk := callers(4, stk[:])
	lock(&proflock)
	b := stkbucket(memProfile, size, stk[:nstk], true)
	mp := b.mp()
	mp.recent_allocs++
	mp.recent_alloc_bytes += size
	unlock(&proflock)

	// Setprofilebucket locks a bunch of other mutexes, so we call it outside of proflock.
	// This reduces potential contention and chances of deadlocks.
	// Since the object must be alive during call to mProf_Malloc,
	// it's fine to do this non-atomically.
	systemstack(func() {
		setprofilebucket(p, b)
	})
}
// Called by malloc to record a profiled block.
Called by malloc to record a profiled block.
// Called by malloc to record a profiled block .
func mProf_Malloc(p unsafe.Pointer, size uintptr) {
	var stk [maxStack]uintptr
	nstk := callers(4, stk[:])
	lock(&proflock)
	b := stkbucket(memProfile, size, stk[:nstk], true)
	mp := b.mp()
	mp.recent_allocs++
	mp.recent_alloc_bytes += size
	unlock(&proflock)
	systemstack(func() {
		setprofilebucket(p, b)
	})
}
func mProf_Malloc ( p unsafe . Pointer , size uintptr ) { var stk [ maxStack ] uintptr nstk := callers ( 4 , stk [ : ] ) lock ( & proflock ) b := stkbucket ( memProfile , size , stk [ : nstk ] , true ) mp := b . mp ( ) mp . recent_allocs ++ mp . recent_alloc_bytes += size unlock ( & proflock ) systemstack ( func ( ) { setprofilebucket ( p , b ) } ) }
Called by malloc to record a profiled block.
Called by malloc to record a profiled block .
// Setprofilebucket locks a bunch of other mutexes, so we call it outside of proflock. // This reduces potential contention and chances of deadlocks. // Since the object must be alive during call to mProf_Malloc, // it's fine to do this non-atomically.