buf_size: first get the size in bytes then convert to elements