'Add a pending deallocation.
The *dtor* arg is the destructor function that takes an argument,
*handle*.  It is used as ``dtor(handle)``.  The *size* arg is the
byte size of the resource added.  It is an optional argument.  Some
resources (e.g. CUModule) has an unknown memory footprint on the device.'

def add_item(self, dtor, handle, size=_SizeNotSet):

    _logger.info('add    pending    dealloc:    %s    %s    bytes', dtor.__name__, size)
    self._cons.append((dtor, handle, size))
    self._size += int(size)
    if ((len(self._cons) > config.CUDA_DEALLOCS_COUNT) or (self._size > self._max_pending_bytes)):
        self.clear()
