chunkCrc32Hash := crc32.NewIEEE() chunkBuf := bufferpool.GetInstance().Get() //回收buffer defer bufferpool.GetInstance().Put(chunkBuf) writer := io.MultiWriter(chunkBuf, chunkCrc32Hash) _, copyErr := io.Copy(writer, chunkResp.RawResponse.Body) if copyErr != nil && copyErr != io.EOF { logmgr.ErrorLogger(ctx, "fail to write chunk data to crc32 or buffer, req: %s, err: %s", originReq.PrettyPrint(), copyErr) return false, exception.OEFException(nil, http.StatusInternalServerError, CopyChunkError, "internal server exception") }
In above codes, it writes chunk data to buffer pool, and the chunk data size is 4MB. When I used golang tool pprof to export memory pprof, there about 8MB space has been allocated. Could somebody help me why golang allocated memory space increases? [image: 20200326-111844.png] -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/6dbe93e6-9bb7-4112-87cb-085e68d9d393%40googlegroups.com.