def compact(self):
"remove any space preallocated for growth"
if self.prealloc_size == self.size:
return
newdata = (self.c_type * self.size)()
ctypes.memmove(newdata, self.data, self.size*self._typesize)
self.data = newdata
self.prealloc_size = self.size
评论列表
文章目录