Delete items that are no longer referenced.
        This operation is safe to perform at any time.
334658
def delete_garbage(self):
        
        self.connection.query(
            "DELETE FROM `{db}`.`{tab}` WHERE ".format(tab=self.table_name, db=self.database) +
            " AND ".join(
                'hash NOT IN (SELECT {column_name} FROM {referencing_table})'.format(**ref)
                for ref in self.references) or "TRUE")
        print('Deleted %d items' % self.connection.query("SELECT ROW_COUNT()").fetchone()[0])
703512
public final void clear() {
        items.clear();
        iconCount = 0;
        dividerCount = 0;

        if (rawItems != null) {
            rawItems.clear();
        }

        notifyOnDataSetChanged();
    }
989947
private void cleanup() {
        StatsDataReference ref = null;
        while ((ref = (StatsDataReference) statisticsReferenceQueue.poll()) != null) {
            StatsData oldStats = null;
            StatsData updatedStats = null;
            do {
                oldStats = terminatedThreadStats.get();
                updatedStats = aggregateStats(oldStats, ref.statsData);
            } while (!terminatedThreadStats.compareAndSet(oldStats, updatedStats));
            allReferences.remove(ref);
        }
    }
816105
private boolean cleanUp(Reference<?> reference) {
    Method finalizeReferentMethod = getFinalizeReferentMethod();
    if (finalizeReferentMethod == null) {
      return false;
    }
    do {
      /*
       * This is for the benefit of phantom references. Weak and soft
       * references will have already been cleared by this point.
       */
      reference.clear();

      if (reference == frqReference) {
        /*
         * The client no longer has a reference to the
         * FinalizableReferenceQueue. We can stop.
         */
        return false;
      }

      try {
        finalizeReferentMethod.invoke(reference);
      } catch (Throwable t) {
        logger.log(Level.SEVERE, "Error cleaning up after reference.", t);
      }

      /*
       * Loop as long as we have references available so as not to waste
       * CPU looking up the Method over and over again.
       */
    } while ((reference = queue.poll()) != null);
    return true;
  }
25998
function removeItem(itemName) {
  // TODO: Only remove used items
  if (data[itemName]) {
    data[itemName] = null;
  }
  if (localExists() && getItem(itemName)) {
    try {
      // Clear session storage
      window.sessionStorage.removeItem(itemName);
    } catch (error) {
      _logger2.default.warn({
        description: 'Error removing item from session storage', error: error,
        obj: 'storage', func: 'removeItem'
      });
    }
  }
}
434374
def cleanup(self):
        
        empty_keys = [k for k, v in self.items() if not v]

        for k in empty_keys:
            del self[k]
195631
def remove(self, item, count=0):
        
        self._client.lrem(self.key_prefix, count, self._dumps(item))
696238
def clear(self):
        
        # go through and properly destroy all the items for this tree
        for item in self.traverseItems():
            if isinstance(item, XTreeWidgetItem):
                item.destroy()
        
        super(XTreeWidget, self).clear()
556943
public function removeAll()
    {
        $this->removed_objects = array_values($this->objects);
        $this->objects = array();
        $this->objects_by_index = array();
        $this->current_index = 0;
    }
415913
def remove(self, _query=None, **kwargs):
        
        for entry in self._find_entries(_query=_query, **kwargs):
            self._service.DeleteRow(entry)
665720
public boolean cleanupPremediatedItemStreams()
  {

	    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
	      SibTr.entry(tc, "cleanupPremediatedItemStreams");

	    // true if all localisations have been cleaned up successfully    
	    boolean allCleanedUp = true;

	    //Only clean up the post mediated itemstreams when all the pre mediated 
	    //itemstreams have been succesfully cleaned up
	    if (allCleanedUp)
	    {
	      // Check each localisation in turn to see if it should be deleted.
	      synchronized (_postMediatedItemStreamsRequiringCleanup)
	      {
	        HashMap clonedLocalisations =
	          (HashMap) _postMediatedItemStreamsRequiringCleanup.clone();
	        // Reallocate the messages from each localisations itemstream that is in 
	        // to-be-deleted state.
	        Iterator i = clonedLocalisations.keySet().iterator();

	        while (i.hasNext())
	        {
	          SIBUuid8 uuid = (SIBUuid8) i.next();
	          PtoPMessageItemStream ptoPMessageItemStream =
	            (PtoPMessageItemStream) _postMediatedItemStreamsRequiringCleanup.get(uuid);
	             
	          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
	            SibTr.debug(tc, "Removing Localisation " + uuid + 
	                            " for destination " + _baseDestinationHandler.getName() + 
	                            " : " + _baseDestinationHandler.getUuid());

	          boolean itemStreamCleanedUp =
	            ptoPMessageItemStream.reallocateMsgs();
	              
	          //we do not remove from xmit queues if it was never added
	          boolean removeFromXmitPoints =
	            !ptoPMessageItemStream.getDeleteRequiredAtReconstitute();

	          if (itemStreamCleanedUp)
	          {
	            _postMediatedItemStreamsRequiringCleanup.remove(uuid);

	            //If the queuePoint is in the "live" queuePoints set, remove it from there too
	            if(removeFromXmitPoints) 
	              _localisationManager.removeXmitQueuePoint(uuid);                
	          }

	          if (allCleanedUp)
	          {
	            allCleanedUp = itemStreamCleanedUp;
	          }
	        }
	      }
	    }  
	     
	    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
	      SibTr.exit(tc, "cleanupPremediatedItemStreams", new Boolean(allCleanedUp));

	    return allCleanedUp;
	  
  }
677308
def remove(self, item):
        ''
        i = self.index(item)
        del self._keys[i]
        del self._items[i]
47143
def deleteUnused(self):
        
        if self.dryrun:
            self._client.listUnused()
        else:
            self._client.deleteUnused()
965058
def remove_all(self, item):
        # type: (Any) -> None
        
        item = self.ref(item)
        while list.__contains__(self, item):
            list.remove(self, item)
1316197
def delete(v)
      return unless include? v
      raise ArgumentError, "Item is protected and cannot be deleted" if protected? index(v)
      @list.delete v
    end
576358
public void clear()
    {
        // clear out ref queue. We don't need to expunge entries
        // since gc'ed entries won't get copied.
        emptyReferenceQueue();

        for (int i = 0; i < table.length; i++)
        {
            Entry e = table[i];
            Entry first = null;
            Entry prev = null;
            while (e != null)
            {
                Object candidate = e.get();
                if (candidate != null)
                {
                    Entry dirty = e.makeDirtyAndWeak(queue);
                    if (first == null)
                    {
                        first = dirty;
                    }
                    if (prev != null)
                    {
                        prev.setNext(dirty);
                    }
                    prev = dirty;
                }
                else
                {
                    if (prev != null)
                    {
                        prev.setNext(e.getState().next);
                    }
                    size--;
                }
                e = e.getState().next;
            }
            table[i] = first;
        }

        // Allocation of array may have caused GC, which may have caused
        // additional entries to go stale.  Removing these entries from the
        // reference queue will make them eligible for reclamation.
        expungeStaleEntries();
    }
896980
public void cleanReferenceCache() {
        final long now = currentDateSupplier.get().getTime();
        final Iterator<HardReference> it = hardReferences.iterator();
        while (it.hasNext()) {
            if (it.next().keeptSince.getTime() + REFERENCE_KEEPING_TIME <= now) {
                it.remove();
            }
        }
    }