在使用http.get()的时候, 内存不释放. 请问大神我该怎么办!

QQ截图20190616225524.png

共 2 个回复


bigbear2

When err is nil, resp always contains a non-nil resp.Body. Caller should close resp.Body when done reading from it.

# 0

vforbox

// When err is nil, resp always contains a non-nil resp.Body.
// Caller should close resp.Body when done reading from it.

if err != nil {
    panic(err)
}

res.Body.Close()
# 1