asio :: streambuf is based on std :: vector, which grows as needed, but never shrinks. So consumume () should not release memory, it just sets up internal pointers:
void consume(std::size_t n) { if (egptr() < pptr()) setg(&buffer_[0], gptr(), pptr()); if (gptr() + n > pptr()) n = pptr() - gptr(); gbump(static_cast<int>(n)); }
But every time you consume () and read () again, the internal buffer (vector) is reused, so you don't have to let go of anything.
source share