On Fri, Aug 15, 2014 at 11:43 AM, Kenton Varda <
ken...@sandstorm.io> wrote:
> Hi Matthew,
>
> At present the only thing you can do is copy the params into a new
> MessageBuilder. Copying should be pretty fast (certainly far faster than a
> protobuf decode).
>
> We could perhaps add something like a disownParams() method. But this could
> be tricky with certain transport implementations. Memory management is the
> transport's job, and it's expected that future transports may care deeply
> about exactly where messages are allocated and when they are freed. For
> example, a shared-memory transport may have a limited amount of shared
> memory to use for transmitting messages. If you don't free the message, you
> may actually be preventing further RPCs from being transmitted, while they
> wait for space to become available. Similarly you could imagine a transport
> implementation that is tied to specialized network hardware that copies
> messages directly into memory from the wire, but only has a limited amount
> of space for doing this.
>
> I'd advise making a copy for now, and take some profiles to see how much
> this actually hurts performance. If it is a problem, we can discuss the
> possibility of adding disownParams() and figure out how to deal with the
> caveats.
or, more generally, on any platform that uses a proactor model. It