From 852c7579796ee104cae85eb60b6730984a9bb02b Mon Sep 17 00:00:00 2001 From: Jaana Burcu Dogan Date: Thu, 3 Nov 2016 21:08:37 -0700 Subject: [PATCH] add gc --- agent/agent.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/agent/agent.go b/agent/agent.go index ac1ff56..611285c 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -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 }