mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: reorganize memory code
Move code from malloc1.go, malloc2.go, mem.go, mgc0.go into appropriate locations. Factor mgc.go into mgc.go, mgcmark.go, mgcsweep.go, mstats.go. A lot of this code was in certain files because the right place was in a C file but it was written in Go, or vice versa. This is one step toward making things actually well-organized again. Change-Id: I6741deb88a7cfb1c17ffe0bcca3989e10207968f Reviewed-on: https://go-review.googlesource.com/5300 Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Rick Hudson <rlh@golang.org>
This commit is contained in:
parent
d384545a45
commit
484f801ff4
20 changed files with 2567 additions and 2593 deletions
|
|
@ -13,6 +13,24 @@ package runtime
|
|||
|
||||
import "unsafe"
|
||||
|
||||
//go:linkname runtime_debug_WriteHeapDump runtime/debug.WriteHeapDump
|
||||
func runtime_debug_WriteHeapDump(fd uintptr) {
|
||||
semacquire(&worldsema, false)
|
||||
gp := getg()
|
||||
gp.m.preemptoff = "write heap dump"
|
||||
systemstack(stoptheworld)
|
||||
|
||||
systemstack(func() {
|
||||
writeheapdump_m(fd)
|
||||
})
|
||||
|
||||
gp.m.preemptoff = ""
|
||||
gp.m.locks++
|
||||
semrelease(&worldsema)
|
||||
systemstack(starttheworld)
|
||||
gp.m.locks--
|
||||
}
|
||||
|
||||
const (
|
||||
fieldKindEol = 0
|
||||
fieldKindPtr = 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue