Inherits IBStream.
|
void | clear () |
|
| FastWriteMemoryStream () |
|
char const * | getData () const |
|
TSize | getSize () const |
|
int64 | pos () const |
|
virtual tresult PLUGIN_API | read (void *buffer, int32 numBytes, int32 *numBytesRead) SMTG_OVERRIDE |
|
void | reset () |
|
virtual tresult PLUGIN_API | seek (int64 pos, int32 mode, int64 *result) SMTG_OVERRIDE |
|
void | setSize (TSize size) |
| returns the current memory size More...
|
|
virtual tresult PLUGIN_API | tell (int64 *pos) SMTG_OVERRIDE |
|
virtual tresult PLUGIN_API | write (void *buffer, int32 numBytes, int32 *numBytesWritten) SMTG_OVERRIDE |
|
virtual | ~FastWriteMemoryStream () |
|
This class is a copy of MemoryStream
for the purpose of fixing the growing issue encountered on Windows 10 when writing a lot of data to it.
MemoryStream
essentially adds 4k whenever new memory is needed and although realloc
is being used, it is extremelly slow on PC/Windows 10. This class implements a similar strategy found in std::vector
: the memory is doubled every time which leads to much less realloc
and much faster performance.
This class does not implement the "non-owning" code since MemoryStream
can be used for this (no memory allocation).
This class fixes the issue with MemoryStream::seek
which blindly sets the cursor potentially outside the valid boundaries.