Improve the memory size estimation in ByteBufferManagedBytes