code: func (b *Buffer) EnsureSpace(s int) {
  	if cap(b.Buf)-len(b.Buf) >= s {
  		return
  	}
  	l := len(b.Buf)
  	if l > 0 {
  		if cap(b.toPool) != cap(b.Buf) {
  			// Chunk was reallocated, toPool can be pooled.
  			putBuf(b.toPool)
  		}
  		if cap(b.bufs) == 0 {
  			b.bufs = make([][]byte, 0, 8)
  		}
  		b.bufs = append(b.bufs, b.Buf)
  		l = cap(b.toPool) * 2
  	} else {
  		l = config.StartSize
  	}
  
  	if l > config.MaxSize {
  		l = config.MaxSize
  	}
  	b.Buf = getBuf(l)
  	b.toPool = b.Buf
  }
docs: // EnsureSpace makes sure that the current chunk contains at least s free bytes,
  // possibly creating a new chunk.