1
0
mirror of https://github.com/google/gops.git synced 2025-02-19 19:59:55 +02:00
This commit is contained in:
Jaana Burcu Dogan 2016-11-03 21:08:37 -07:00
parent 8528cf11e5
commit 852c757979

View File

@ -17,6 +17,9 @@ import (
const (
// Stack represents a command to print stack trace.
Stack = byte(0x1)
// GC runs the garbage collector.
GC = byte(0x2)
)
func init() {
@ -54,6 +57,10 @@ func handle(conn net.Conn, msg []byte) error {
n := runtime.Stack(buf, true)
_, err := conn.Write(buf[:n])
return err
case GC:
runtime.GC()
_, err := conn.Write([]byte("ok"))
return err
}
return nil
}