[ https://issues.apache.org/jira/browse/THRIFT-3854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15462647#comment-15462647 ]
ASF GitHub Bot commented on THRIFT-3854: ---------------------------------------- GitHub user nsuke opened a pull request: https://github.com/apache/thrift/pull/1081 THRIFT-3854 add a way in java to clear TFramedTransport read buffers imported from JIRA issue. You can merge this pull request into a Git repository by running: $ git pull https://github.com/nsuke/thrift THRIFT-3854 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/thrift/pull/1081.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1081 ---- commit 839b88a4fa836bd30fa01fd047d9a4ba5b138a87 Author: Chris Lockfort <clockf...@palantir.com> Date: 2016-06-16T21:52:19Z THRIFT-3854 add a way in java to clear TFramedTransport read buffers The use case that I would like this for is that I have a large number of Thrift connections in a connection pool, and upon return the used connection to the pool I would like to eagerly clean up the read buffer because I know it will not be used again until the connection is checked out and a new read puts a new buffer in its place. This saves a considerable amount of heap memory in my application. ---- > allow users to clear read buffers > --------------------------------- > > Key: THRIFT-3854 > URL: https://issues.apache.org/jira/browse/THRIFT-3854 > Project: Thrift > Issue Type: Improvement > Components: Java - Library > Reporter: Chris Lockfort > Priority: Minor > Attachments: thrift-3854-clearable-read-buffers.patch > > > My use case (which I believe many others would share): > - I have a large number of Thrift connections in a connection pool > - Upon return of the used connection to the pool I would like to eagerly > clean up the read buffer because I know it will not be used again until the > connection is checked out and a new read puts a new buffer in its place. > - Eagerly clearing the read buffers of idle connections saves a considerable > amount of heap memory in my application, vs. having all of the idle > connections keep all of their read buffers allocated. > - Currently, it looks like someone thought about this and there is a > TMemoryInputTransport#clear() , but it isn't callable from people with a > TFramedTransport which uses a TMemoryInputTransport for its read buffer > (unless you count doing gross and brittle reflection magic). > I've included a patch, but I'm very flexible / open to opinions of how > someone more familiar to this project would want to implement a feature like > this. -- This message was sent by Atlassian JIRA (v6.3.4#6332)