Delete the MUMPS context and release all array references.
340131
def destroy(self):
        """"""
        if self.id is not None and self._mumps_c is not None:
            self.id.job = -2 # JOB_END
            self._mumps_c(self.id)
        self.id = None
        self._refs = None
826260
def delete_all
      @loaded_constants.each do |const_name|
        if Object.const_defined?(const_name)
          Object.send(:remove_const, const_name)
        end
      end
      Ichiban::HTMLCompiler::Context.clear_user_defined_helpers
    end
701931
final public function destroy()
    {
        foreach ($this->registry as $offset => $object) {
            if (method_exists($object, '__destruct')) {
                $object->__destruct();
            }
            unset($this->registry[ $offset ]);
        }
    }
795765
protected void clearReferences() {

        // Unregister any JDBC drivers loaded by this classloader
        Enumeration drivers = DriverManager.getDrivers();
        while (drivers.hasMoreElements()) {
            Driver driver = (Driver) drivers.nextElement();
            if (driver.getClass().getClassLoader() == this) {
                try {
                    DriverManager.deregisterDriver(driver);
                } catch (SQLException e) {
                    log.warn("SQL driver deregistration failed", e);
                }
            }
        }
        
        // Null out any static or final fields from loaded classes,
        // as a workaround for apparent garbage collection bugs
        if (ENABLE_CLEAR_REFERENCES) {
            Iterator loadedClasses = ((HashMap)((HashMap) resourceEntries).clone()).values().iterator();
            while (loadedClasses.hasNext()) {
                ResourceEntry entry = (ResourceEntry) loadedClasses.next();
                if (entry.loadedClass != null) {
                    Class clazz = entry.loadedClass;
                    try {
                        Field[] fields = clazz.getDeclaredFields();
                        for (int i = 0; i < fields.length; i++) {
                            Field field = fields[i];
                            int mods = field.getModifiers();
                            if (field.getType().isPrimitive() 
                                    || (field.getName().indexOf("$") != -1)) {
                                continue;
                            }
                            if (Modifier.isStatic(mods)) {
                                try {
                                    field.setAccessible(true);
                                    if (Modifier.isFinal(mods)) {
                                        if (!((field.getType().getName().startsWith("java."))
                                                || (field.getType().getName().startsWith("javax.")))) {
                                            nullInstance(field.get(null));
                                        }
                                    } else {
                                        field.set(null, null);
                                        if (log.isDebugEnabled()) {
                                            log.debug("Set field " + field.getName() 
                                                    + " to null in class " + clazz.getName());
                                        }
                                    }
                                } catch (Throwable t) {
                                    if (log.isDebugEnabled()) {
                                        log.debug("Could not set field " + field.getName() 
                                                + " to null in class " + clazz.getName(), t);
                                    }
                                }
                            }
                        }
                    } catch (Throwable t) {
                        if (log.isDebugEnabled()) {
                            log.debug("Could not clean fields for class " + clazz.getName(), t);
                        }
                    }
                }
            }
        }
        
         // Clear the IntrospectionUtils cache.
        IntrospectionUtils.clear();
        
        // Clear the classloader reference in common-logging
        org.apache.juli.logging.LogFactory.release(this);
        
        // Clear the classloader reference in the VM's bean introspector
        java.beans.Introspector.flushCaches();

    }
845240
public void clear() {
        // clear out ref queue. We don't need to expunge entries
        // since table is getting cleared.
        while (queue.poll() != null)
            ;

        modCount++;
        Arrays.fill(table, null);
        size = 0;

        // 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.
        while (queue.poll() != null)
            ;
    }
977809
public final synchronized void clear()
	{
		timestamps = new long[max ? timestamps.length : STD_BUFSIZE];
		value = new CEMILData[timestamps.length];
		next = 0;
		size = 0;
	}
894952
public void clear()
  {
    for (int i = 0; i < values.length; i++) {
      keys[i] = DEAD_KEY;
      flags[i] = 0;
      values[i] = null;
    }
    size = 0;
  }
880275
public static function destroyCurrentContext()
    {
        $poolResources = RequestContext::get('poolResources', []);
        foreach($poolResources as $resource)
        {
            $resource->getPool()->release($resource);
        }
        RequestContext::set('poolResources', []);
    }
693612
def clear(self):
        
        with self._hlock:
            self.handlers.clear()
        with self._mlock:
            self.memoize.clear()
747576
public function cleanup(): void
    {
        foreach ($this->getStore() as $key => $value)
        {
            $this->remove($key);
        }
    }
469016
public static function cleanup() {
        global $DB;

        // Clean up stuff that depends on contexts that do not exist anymore.
        $sql = "SELECT DISTINCT ap.contextid FROM {analytics_predictions} ap
                  LEFT JOIN {context} ctx ON ap.contextid = ctx.id
                 WHERE ctx.id IS NULL";
        $apcontexts = $DB->get_records_sql($sql);

        $sql = "SELECT DISTINCT aic.contextid FROM {analytics_indicator_calc} aic
                  LEFT JOIN {context} ctx ON aic.contextid = ctx.id
                 WHERE ctx.id IS NULL";
        $indcalccontexts = $DB->get_records_sql($sql);

        $contexts = $apcontexts + $indcalccontexts;
        if ($contexts) {
            list($sql, $params) = $DB->get_in_or_equal(array_keys($contexts));
            $DB->execute("DELETE FROM {analytics_prediction_actions} WHERE predictionid IN
                (SELECT ap.id FROM {analytics_predictions} ap WHERE ap.contextid $sql)", $params);

            $DB->delete_records_select('analytics_predictions', "contextid $sql", $params);
            $DB->delete_records_select('analytics_indicator_calc', "contextid $sql", $params);
        }

        // Clean up stuff that depends on analysable ids that do not exist anymore.
        $models = self::get_all_models();
        foreach ($models as $model) {
            $analyser = $model->get_analyser(array('notimesplitting' => true));
            $analysables = $analyser->get_analysables_iterator();

            $analysableids = [];
            foreach ($analysables as $analysable) {
                if (!$analysable) {
                    continue;
                }
                $analysableids[] = $analysable->get_id();
            }
            if (empty($analysableids)) {
                continue;
            }

            list($notinsql, $params) = $DB->get_in_or_equal($analysableids, SQL_PARAMS_NAMED, 'param', false);
            $params['modelid'] = $model->get_id();

            $DB->delete_records_select('analytics_predict_samples', "modelid = :modelid AND analysableid $notinsql", $params);
            $DB->delete_records_select('analytics_train_samples', "modelid = :modelid AND analysableid $notinsql", $params);
        }
    }
1275467
public void clear() {
    for (final Pair<ExecutionReference, ExecutableFlow> pair : this.queuedFlowMap.values()) {
      dequeue(pair.getFirst().getExecId());
    }
  }
1274546
public function clear()
    {
        $shmid = shm_attach($this->sysvKey, $this->shmSize, $this->perm);
        shm_remove_var($shmid, self::VAR_KEY);
    }
991571
public void cleanup() {
        ArrayList<ProducerReference> producerReferences = new ArrayList<ProducerReference>(registry.values());
        for (ProducerReference p : producerReferences) {
            try {
                if (p.get() != null)
                    unregisterProducer(p.get());
            } catch (Exception e) {
                LOGGER.warn("can't unregister producer " + p, e);
            }
        }
    }
559504
public void clear() {
        int n = mSize;
        Object[] values = mValues;

        for (int i = 0; i < n; i++) {
            values[i] = null;
        }

        mSize = 0;
        mGarbage = false;
    }
842168
private void cleanup() {
        Entry<K, V>[] tab = this.table;

        for (int i = tab.length ; i-- > 0 ;) {
            for (Entry<K, V> e = tab[i], prev = null; e != null; e = e.next) {
                if (e.get() == null) {
                    // Clean up after a cleared Reference.
                    this.modCount++;
                    if (prev != null) {
                        prev.next = e.next;
                    } else {
                        tab[i] = e.next;
                    }
                    this.count--;
                } else {
                    prev = e;
                }
            }
        }
    }
762945
def _cleanup(self, kill, verbose):
        
        if kill:
            removed_indices = self.g.prune()

            self.nout -= len(removed_indices)

            if verbose and removed_indices:
                print('Removing %s' % removed_indices)

            for j in removed_indices:
                self.inv_map.pop(j[0])