[ 
https://issues.apache.org/jira/browse/THRIFT-3481?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15052032#comment-15052032
 ] 

Xiaoshuang LU commented on THRIFT-3481:
---------------------------------------

{code}
    // sufficiently large
    char buffer[4096];

    boost::shared_ptr<TMemoryBuffer> transport{ new TMemoryBuffer(buffer, 1024, 
TMemoryBuffer::OBSERVE) };
    boost::shared_ptr<TBinaryProtocol> protocol{ new TBinaryProtocol(transport) 
};

    object.write(protocol.get());
{code}

We will get

{code}
terminate called after throwing an instance of 
'apache::thrift::transport::TTransportException'
  what():  Insufficient space in external MemoryBuffer
Aborted (core dumped)
{code}

> introduce TSimpleMemoryTransport which wraps a customer owned memory chunk to 
> conduct both read and write operations
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-3481
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3481
>             Project: Thrift
>          Issue Type: New Feature
>          Components: C++ - Library
>    Affects Versions: 0.9.3
>            Reporter: Xiaoshuang LU
>             Fix For: 0.9.4
>
>         Attachments: THRIFT-3481.patch
>
>
> It would be great if there is a transport class which 1. does not need to 
> care about the memory management, 2. is capable of both read and write 
> operations.
> TMemoryBuffer is very close to the requirements, but no data can be written 
> to observed TMemoryBuffer as stated in the comments.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to