(self, args)
Remove an array from memory.
Remove an array from memory.
Remove an array from memory .
def erase_(self, args):
        """Remove an array from memory."""
        for name in args:
            name = self._memory.complete_name(name)
            if name not in self._dims:
                # IFC if array does not exist
                raise error.BASICError(error.IFC)
            dimensions = self._dims[name]
            record_len = 1 + max(3, len(name)) + 3 + 2*len(dimensions)
            freed_bytes = self.array_len(dimensions) * values.size_bytes(name) + record_len
            erased_name_ptr, _ = self._array_memory[name]
            # delete buffers
            del self._dims[name]
            del self._buffers[name]
            del self._array_memory[name]
            # update memory model
            for name in self._array_memory:
                name_ptr, array_ptr = self._array_memory[name]
                if name_ptr > erased_name_ptr:
                    self._array_memory[name] = name_ptr - freed_bytes, array_ptr - freed_bytes
            self.current -= freed_bytes
def erase_ ( self , args ) : for name in args : name = self . _memory . complete_name ( name ) if name not in self . _dims : # IFC if array does not exist raise error . BASICError ( error . IFC ) dimensions = self . _dims [ name ] record_len = 1 + max ( 3 , len ( name ) ) + 3 + 2 * len ( dimensions ) freed_bytes = self . array_len ( dimensions ) * values . size_bytes ( name ) + record_len erased_name_ptr , _ = self . _array_memory [ name ] # delete buffers del self . _dims [ name ] del self . _buffers [ name ] del self . _array_memory [ name ] # update memory model for name in self . _array_memory : name_ptr , array_ptr = self . _array_memory [ name ] if name_ptr > erased_name_ptr : self . _array_memory [ name ] = name_ptr - freed_bytes , array_ptr - freed_bytes self . current -= freed_bytes