The size of boost :: asio :: streambuf will continue to grow until a call to () is called.
Even after calling consume (), the memory used by the underlying buffer will never be released.
For example: the following code first created streambuf without specifying max_size. Then it flushes the 14 MB data in streambuf. Then it consumes all this data of size 14 MB. At point 2000, streambuf.size () is 0, but the "top" indicates that the process still takes up 14 MB of memory.
I do not want to specify max_size. Is there anyway to compress streambuf after it is empty?
#include <boost/asio.hpp>
source share