code: func (f *freelist) write(p *page) error {
  	// Combine the old free pgids and pgids waiting on an open transaction.
  
  	// Update the header flag.
  	p.flags |= freelistPageFlag
  
  	// The page.count can only hold up to 64k elements so if we overflow that
  	// number then we handle it by putting the size in the first element.
  	lenids := f.count()
  	if lenids == 0 {
  		p.count = uint16(lenids)
  	} else if lenids < 0xFFFF {
  		p.count = uint16(lenids)
  		f.copyall(((*[maxAllocSize]pgid)(unsafe.Pointer(&p.ptr)))[:])
  	} else {
  		p.count = 0xFFFF
  		((*[maxAllocSize]pgid)(unsafe.Pointer(&p.ptr)))[0] = pgid(lenids)
  		f.copyall(((*[maxAllocSize]pgid)(unsafe.Pointer(&p.ptr)))[1:])
  	}
  
  	return nil
  }
docs: // write writes the page ids onto a freelist page. All free and pending ids are
  // saved to disk since in the event of a program crash, all pending ids will
  // become free.