This method guarantees that garbage collection is
done unlike <code>{@link System#gc()}</code>
503349
public static void gc(){
        Object obj = new Object();
        WeakReference ref = new WeakReference<Object>(obj);
        obj = null;
        while(ref.get()!=null)
            System.gc();
    }
1206596
public T remove()
    {
        if ( size == 0 ) {
            return null;
        }
        
        //remove the first element
        Entry<T> o = head.next;
        head.next   = o.next;
        o.next.prev = head;
        
        //bakup the data
        T v         = o.data;
        size--;
        index.remove(v.getValue());
        
        o = null;            //Let gc do its work
        
        return v;
    }
114501
boolean enqueue(Reference<? extends T> reference) {
        synchronized (lock) {
            if (enqueueLocked(reference)) {
                lock.notifyAll();
                return true;
            }
            return false;
        }
    }
602059
public T allocate()
  {
    while (true) {
      SoftReference<T> ref;
      
      ref = _ringQueue.poll();
      
      if (ref == null) {
        return null;
      }
      
      T value = ref.get();
      
      if (value != null) {
        return value;
      }
    }
  }
433909
public static void gc() {
    class GCTask extends DTask<GCTask> {
      public GCTask() {super(GUI_PRIORITY);}
      @Override public void compute2() {
        Log.info("Calling System.gc() now...");
        System.gc();
        Log.info("System.gc() finished");
        tryComplete();
      }
    }

    for (H2ONode node : H2O.CLOUD._memary) {
      GCTask t = new GCTask();
      new RPC<>(node, t).call().get();
    }
  }
1237456
private function gc()
    {
        // Whether to refresh the data
        $refresh = false;

        foreach (array_keys($this->arrayCache->getData()) as $key) {
            // Do remove outdated keys from the collection
            if ($this->arrayCache->isExpired($key, time())) {
                $refresh = true;
                $this->arrayCache->remove($key);
            }
        }

        if ($refresh === true) {
            // Explicit save with fresh data
            $this->write();
        }
    }
546548
private static void garbageCollectUnusedLevels() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "garbageCollectUnusedLevels");

        final int numLevels = _syncLevels.size();
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "Levels: " + numLevels);

        // No need to do anything if we only have one level
        if (numLevels < 2) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                Tr.exit(tc, "garbageCollectUnusedLevels", "Doing nothing");
            return;
        }

        final int[] counts = new int[numLevels];

        // Check through all transactions to see which levels are still in use
        final TransactionImpl[] txns = LocalTIDTable.getAllTransactions();

        // Record the levels with transactions referring to them

        // Record the levels with transactions referring to them
        for (int i = txns.length; --i >= 0;) {
            // TransactionImpl has a dependency on CORBA which we definitely don't want
            // Skip this step to avoid a classcastexception
            // TODO can we work around the dependency?
            int level = 0;
            // final int level = ((com.ibm.ws.tx.jta.TransactionImpl) txns[i]).getExtJTASyncLevel();
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "Not generating any counts for garbageCollectUnusedLevels()");
            }

            if (level >= 0 && level < numLevels) {
                counts[level]++;
            }
        }

        // Now null out the levels with no references
        for (int i = counts.length; --i >= 0;) {
            // We never want to null out the current level
            if (i != _syncLevel) {
                if (counts[i] == 0) {
                    _syncLevels.set(i, null);
                }
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "garbageCollectUnusedLevels", _syncLevels.size());
    }
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();
    }
579983
public boolean decrement() {
		synchronized (lock) {
			if (isDisposed) {
				return false;
			}

			referenceCount--;

			if (referenceCount <= disposeOnReferenceCount) {
				isDisposed = true;
			}

			return isDisposed;
		}
	}
32171
private void gc() {
    if ((services != null && services.isConnected()) && debugger != null) {
      debugger.releaseObjects();
    }
    objectIds.clear();
  }
108287
@Override
    public int getStorageStrategy()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "getStorageStrategy");

        int storageStrategy;

        Reliability rel = getReliability();
        if (rel == Reliability.BEST_EFFORT_NONPERSISTENT)
        {
            storageStrategy = STORE_NEVER;
        }
        else
        {
            // If the message has a reliability of Assured the storage strategy is
            // STORE_ALWAYS except when this message is for pubsub and only has
            // non-durable references. In this case the references will be
            // STORE_MAYBE as there is no need to make the message more robust.
            if ((maintainPersistence != 0)
                && (rel == Reliability.RELIABLE_PERSISTENT))
            {
                storageStrategy = STORE_EVENTUALLY;
            }
            else if ((maintainPersistence != 0)
                     && (rel == Reliability.ASSURED_PERSISTENT))
            {
                storageStrategy = STORE_ALWAYS;
            }
            else
            {
                storageStrategy = STORE_MAYBE;
            }
        }

        // ensure value does not exceed maximum permitted, eg not
        // possible to store assured on a temporary destination
        storageStrategy =
                        storageStrategy < maxStorageStrategy
                                        ? storageStrategy
                                        : maxStorageStrategy;

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "getStorageStrategy", Integer.valueOf(storageStrategy));

        return storageStrategy;
    }
492727
protected final void verify() {
        collectInitialisers();
        verifyCandidates();
        verifyInitialisers();
        collectPossibleInitialValues();
        verifyPossibleInitialValues();
        collectEffectiveAssignmentInstructions();
        verifyEffectiveAssignmentInstructions();
        collectAssignmentGuards();
        verifyAssignmentGuards();
        end();
    }
1165411
public function action_gc( $params ) 
	{
		$manager = $this->get_manager( $params );
		$manager->gc();
		
		$this->success( 'Garbage collection executed successfully' );
	}
1324093
public function gc() 
	{
		$lifetime = \CCArr::get( 'lifetime', $this->_config, \CCDate::minutes( 5 ) );
		
		if ( $lifetime < ( $min_lifetime = \CCArr::get( 'min_lifetime', $this->_config, \CCDate::minutes( 5 ) ) ) )
		{
			$lifetime = $min_lifetime;
		}
		
		$this->_driver->gc( $lifetime );
	}
1076944
@Override
    public int getStorageStrategy()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "getStorageStrategy");

        int storageStrat = getMessageItem().getStorageStrategy();

        // It is possible that this reference has a lesser storage strategy
        // from the referenced message item.
        if (downgradePersistence)
        {
            // the maximum required 'persistence' is STORE_MAYBE
            if (storageStrat > STORE_MAYBE)
                storageStrat = STORE_MAYBE;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "getStorageStrategy", Integer.valueOf(storageStrat));

        return storageStrat;
    }
431448
@Override
    public void reset() {
        // just replace accumulator, gc will do the rest
        accumulator = new ThreadLocal<>();

        // resetting this counter too
        workersCounter.set(0);

        // reset indexes too
        index = new ThreadLocal<>();

        // throw away message queues
        for (int i = 0; i < parties; i++) {
            messages.get(i).clear();
        }
    }
136821
@Trivial
    protected synchronized int size(int bufferType) {
        if (bufferType == EXPLICIT_BUFFER) {
            return this.explicitBuffer.size();
        } else if (bufferType == SCAN_BUFFER) {
            return this.scanBuffer.size();
        } else if (bufferType == GC_BUFFER) {
            return this.garbageCollectorBuffer.size();
        }
        return 0;
    }