func main() {
go GetTest()
select {}
}
func GetTest() {
for {
resp, ok := http.Get("http://localhost/index.php")
if ok != nil {
os.Exit(0)
}
resp.Body.Close()
time.Sleep(1 * time.Second)
}
}
我在一个协程中每个1秒就发出一次get请求,然后主动关闭body,但是这个程序在运行时内存一直在增加,请问下这是哪方面的资源没释放呢?
这个看着像是没有gc 呢把, 内存累计一段时间后做垃圾回收的。