mirror of
https://github.com/google/gops.git
synced 2025-02-19 19:59:55 +02:00
add gc
This commit is contained in:
parent
8528cf11e5
commit
852c757979
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user