-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
My application layer is already allocating a memory buffers to which it copies/creates data. Optimally, I would like to serialize and send this data to S3 without having to allocate (and copy to) another buffer in the process. Is there an easy way to avoid buffer allocation and data copy in PutObject flow?
As far as I understand it, in order to use PutObject on an already-in-memory data, I need to create an IOStream from some streambuf object. SDK does offers creating a PreallocatedStreamBuf (so one unnecessary copy is saved) but only from an Aws::Utils::Array, which always allocates its own buffer.
Ideally for me, SDK would expose another kind of PreallocatedStreamBuf that takes a pointer of a memory buffer with no additional overhead, or another kind of Array which can be constructed with a preallocated buffer. In any case, buffer ownership should remain at application layer (which also needs to release it later).
One solution can be to change my application layer to allocate its buffers only via AWS SDK Arrays but I don't really like this solution because my application already has its own memory management and also I would have to change too many layers and APIs along the way.
I can probably do the tedious work of deriving another streambuf myself but I was wondering if I was missing something or maybe there are future plans to expose such API?
Help would be appreciated. Thanks!