Skip to content

Commit

Permalink
runtime: reorganize memory code
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Rick Hudson <[email protected]>
  • Loading branch information
rsc committed Feb 19, 2015
1 parent d384545 commit 484f801
Show file tree
Hide file tree
Showing 20 changed files with 2,539 additions and 2,565 deletions.
18 changes: 18 additions & 0 deletions src/runtime/heapdump.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 484f801

Please sign in to comment.