[
https://issues.apache.org/jira/browse/THRIFT-265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12678636#action_12678636
]
Alexander Shigin commented on THRIFT-265:
-----------------------------------------
+1 to Anthony Giardullo
I can misunderstand something, but the next snippet seems wrong to me.
{code}
+ void * new_buffer = std::realloc(readBuffer_, readBufferSize_);
+ if (new_buffer == NULL) {
+ GlobalOutput("TConnection::transition() realloc");
+ close();
+ return;
+ }
+ readBuffer_ = (uint8_t*) new_buffer;
+ readBufferSize_ = 1024;
{code}
I believe that the right version should set readBufferSize_ before realloc.
{code}
+ readBufferSize_ = 1024;
+ void * new_buffer = std::realloc(readBuffer_, readBufferSize_);
+ if (new_buffer == NULL) {
+ GlobalOutput("TConnection::transition() realloc");
+ close();
+ return;
+ }
+ readBuffer_ = (uint8_t*) new_buffer;
{code}
> Buffer bloat in TNonblockingServer
> ----------------------------------
>
> Key: THRIFT-265
> URL: https://issues.apache.org/jira/browse/THRIFT-265
> Project: Thrift
> Issue Type: Improvement
> Components: Library (C++)
> Reporter: Erik Frey
> Assignee: Erik Frey
> Priority: Minor
> Attachments: buffer_reset.patch, graph.png
>
>
> TNonBlockingServer never resets the lengths of the buffers it maintains for
> reading and writing. Servers with a long life and many concurrent
> connections eventually generate an overhead that can reach into the
> gigabytes, particularly in services that have varied message sizes.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.