Golang:在json.Decode / Unmarshal之后的profiler中有很多堆项

时间:2016-08-09 13:29:12

标签: json go memory-leaks heap profiler

我有一个golang脚本示例:它获取页面响应并将其作为goroutine的不定式循环中的主体解组。

#   0x6b7699    compress/flate.NewReader+0x49           /usr/local/go/src/compress/flate/inflate.go:828
#   0x5f339d    compress/gzip.(*Reader).readHeader+0x7ad    /usr/local/go/src/compress/gzip/gunzip.go:254
#   0x5f1da7    compress/gzip.NewReader+0x207           /usr/local/go/src/compress/gzip/gunzip.go:95
#   0x4d5117    net/http.(*gzipReader).Read+0x97        /usr/local/go/src/net/http/transport.go:1658
#   0x4d4c6a    net/http.(*bodyEOFSignal).Read+0x26a        /usr/local/go/src/net/http/transport.go:1613
#   0x502617    encoding/json.(*Decoder).refill+0x287       /usr/local/go/src/encoding/json/stream.go:152
#   0x5022a3    encoding/json.(*Decoder).readValue+0x413    /usr/local/go/src/encoding/json/stream.go:128
#   0x501ba9    encoding/json.(*Decoder).Decode+0x159               /usr/local/go/src/encoding/json/stream.go:57
#   0x401219    main.DoTask+0x169               /root/test.go:21
#   0x4012f9    main.main.func1+0x29                /root/test.go:30

但是当我打开探查器时,堆项的数量正在增加 时间。 堆项的示例:

{{1}}

难道你不能解释,问题是什么?无论如何,谢谢你

0 个答案:

没有答案