reduce a memory copy by reading buffer use ringbuf