You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/09/18 00:58:22 UTC

[GitHub] [dubbo-getty] AlexStocks commented on a change in pull request #76: remove read buffer collection

AlexStocks commented on a change in pull request #76:
URL: https://github.com/apache/dubbo-getty/pull/76#discussion_r711415672



##########
File path: session.go
##########
@@ -607,12 +607,10 @@ func (s *session) handleTCPPackage() error {
 	bufp = gxbytes.GetBytes(maxReadBufLen)
 	buf = *bufp
 
-	// pktBuf = new(bytes.Buffer)
-	pktBuf = gxbytes.GetBytesBuffer()
+	pktBuf = new(bytes.Buffer)
 
 	defer func() {
 		gxbytes.PutBytes(bufp)
-		gxbytes.PutBytesBuffer(pktBuf)

Review comment:
       就算按照你这个改进,这个 defer 根本就不需要了。因为你每个 pkgBuf 都是 new 出来的。对 gxbytes 中的 缓存池而言,只有 put 没有 get,还是会造成内存被缓存。




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org