base/console: Use buffer on heap

Use a small buffer on the heap and allocate it once. Reduces the
memory footprint and is probably faster.
Use "!empty" instead of "size" on std containers to check if they
contain data.