chunkCrc32Hash := crc32.NewIEEE()
chunkBuf := bufferpool.GetInstance().Get()
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 
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 view this discussion on the web visit

Reply via email to