aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/malloc.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/malloc.go')
-rw-r--r--src/runtime/malloc.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go
index 5a0d85f645..e1ec5e6496 100644
--- a/src/runtime/malloc.go
+++ b/src/runtime/malloc.go
@@ -1207,7 +1207,16 @@ func reflect_unsafe_NewArray(typ *_type, n int) unsafe.Pointer {
}
func profilealloc(mp *m, x unsafe.Pointer, size uintptr) {
- mp.p.ptr().mcache.next_sample = nextSample()
+ var c *mcache
+ if mp.p != 0 {
+ c = mp.p.ptr().mcache
+ } else {
+ c = mcache0
+ if c == nil {
+ throw("profilealloc called with no P")
+ }
+ }
+ c.next_sample = nextSample()
mProf_Malloc(x, size)
}