tylitianrui commented on a change in pull request #271:
URL: https://github.com/apache/dubbo-go-hessian2/pull/271#discussion_r661073289



##########
File path: encode.go
##########
@@ -50,7 +50,13 @@ func NewEncoder() *Encoder {
 
 // Clean clean the Encoder (room) for a new object encoding.
 func (e *Encoder) Clean() {
-       buffer := make([]byte, 64)

Review comment:
       @wongoo Making  a slice of  byte  have  an  advantage: avoiding  memory 
leak  caused  by  growth of  underlying  array .  but  making it , when  call  
method `Clean` every  time, is  unnecessary too.  the underlying  array can be 
reused. 
   this PR, have two advantages:   
   - reusing the  buffer (reducing memory-allocation);  
    - avoiding  memory leak  caused  by  growth of  underlying  array 




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to