wwbmmm commented on issue #2120:
URL: https://github.com/apache/brpc/issues/2120#issuecomment-1440086114

   
   > 
   > 
那也就是说可以这么实现?在协议层直接预先分配内存,后续从fd读取的数据可以保证不会超过这个大小,这样就能保证block的数量始终保持为1,然后在读取数据的时候通过fetch方法来避免拷贝,我理解这样的改动是最小的?
   > 
   > else if (source->length() < sizeof(header_buf) + body_size) { // 
预先分配size大小的内存,并作为一个block放入source中,然后将source->length()的内容拷贝进这个block里 source-> 
reserve_continuous_buffer(sizeof(header_buf) + body_size) return 
MakeParseError(PARSE_ERROR_NOT_ENOUGH_DATA); }
   
   可以这样试试


-- 
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