public function free()
{
if (!$this->isFreed()) {
// Invalidate the memory block by setting its state to FREED.
$this->setHeader(static::STATE_FREED, 0, 0);
// Request the block to be deleted, then close our local handle.
$this->memDelete();
shmop_close($this->handle);
$this->handle = null;
$this->semaphore->free();
}
}