Clean data from shared memory block
4923
protected function clean()
    {
        if ($this->exists()) {
            $id = shmop_open($this->id, "a", 0, 0);
            shmop_delete($id);
            shmop_close($id);
        }
    }
492485
def clean(ctx, state, dry_run=False, bare=False, user=False):
    """"""
    from ..core import do_clean
    do_clean(ctx=ctx, three=state.three, python=state.python, dry_run=dry_run,
             system=state.system)
1347680
private int allocDataBlock() 
    {
        int newBlock = m_dataLength_;
        int newTop = newBlock + DATA_BLOCK_LENGTH;
        if (newTop > m_dataCapacity_) {
            // out of memory in the data array
            return -1;
        }
        m_dataLength_ = newTop;
        return newBlock;
    }
1232177
synchronized void cleanUp() {

        updateAccessCounts();

        int                          removeCount = size() / 2;
        int accessTarget = getAccessCountCeiling(removeCount, removeCount / 8);
        BaseHashMap.BaseHashIterator it          = new BaseHashIterator();
        int                          savecount   = 0;

        for (; it.hasNext(); ) {
            CachedObject r = (CachedObject) it.next();

            if (it.getAccessCount() <= accessTarget) {
                synchronized (r) {
                    if (!r.isKeepInMemory()) {
                        r.setInMemory(false);

                        if (r.hasChanged()) {
                            rowTable[savecount++] = r;
                        }

                        it.remove();

                        cacheBytesLength -= r.getStorageSize();

                        removeCount--;
                    }
                }
            }
        }

        if (removeCount > 50) {
            it = new BaseHashIterator();

            for (; removeCount >= 0 && it.hasNext(); ) {
                CachedObject r = (CachedObject) it.next();

                if (!r.isKeepInMemory()) {
                    r.setInMemory(false);

                    if (r.hasChanged()) {
                        rowTable[savecount++] = r;
                    }

                    it.remove();

                    cacheBytesLength -= r.getStorageSize();

                    removeCount--;
                }
            }
        }

        super.setAccessCountFloor(accessTarget);
        saveRows(savecount);
    }
904313
@Override
	protected void readDataBlock(byte[] data, int offset, int len, int blockHandle) throws DataStoreException
    {
    	byte[] dirtyBlock = dirtyBlockTable.get(blockHandle);
    	if (dirtyBlock != null)
    	{
    		// Copy data from memory-cached dirty block
    		System.arraycopy(dirtyBlock, 0, data, offset, len);
    	}
    	else
    	{
    		try
    		{
    			long dataOffset = (long)blockHandle*blockSize;
    			
	    		// Make sure we do not conflict with another async operation
	    		synchronized (dataRandomAccessFile)
				{
			        dataRandomAccessFile.seek(dataOffset);
			        if (dataRandomAccessFile.read(data,offset,len) != len)
			            throw new DataStoreException("Cannot read "+len+" bytes from store file");
				}
    		}
    		catch (DataStoreException e)
    		{
    		    throw e;
    		}
            catch (IOException e)
            {
                throw new DataStoreException("Could not read data block "+blockHandle,e);
            }
    	}
    }
1100382
def _removeLru(self):
        
        (dataFile, handle) = self._cache.pop()
        handle.close()
        return dataFile
462568
def _clean_streams(repo, mapped_streams):
    """"""
    for stream_name in ('stdout', 'stderr'):
        stream = mapped_streams.get(stream_name)
        if not stream:
            continue

        path = os.path.relpath(stream, start=repo.working_dir)
        if (path, 0) not in repo.index.entries:
            os.remove(stream)
        else:
            blob = repo.index.entries[(path, 0)].to_blob(repo)
            with open(path, 'wb') as fp:
                fp.write(blob.data_stream.read())
1284301
def cleanup(self):
        
        #First we *copy* the arrays that we currently have pointers to. This is not
        #the optimal solution; however, because of limitations in ctypes, we don't
        #know anything better at the moment.
        for key in self.result:
            self.result[key] = self.result[key].copy()

        #Now deallocate the pointers managed by Fortran in the shared library so that
        #any subsequent calls to the executable that generated this result creates
        #new instances in memory.
        for key in list(self._finalizers.keys()):
            self._finalizers[key].clean()
1252304
def Clean():
  """"""
  # Find all the compiled proto files and unlink them.
  for (root, _, files) in os.walk(ROOT):
    for filename in files:
      full_filename = os.path.join(root, filename)
      if full_filename.endswith("_pb2.py") or full_filename.endswith(
          "_pb2.pyc"):
        os.unlink(full_filename)
862014
def free_memory(cls, exclude=None):
        """"""

        annotations_in_memory = Annotation.__ANNOTATIONS_IN_MEMORY__

        exclude = () if exclude is None else exclude

        for annotation_cls in list(annotations_in_memory.keys()):

            if issubclass(annotation_cls, exclude):
                continue

            if issubclass(annotation_cls, cls):
                del annotations_in_memory[annotation_cls]
647297
def clean_data(self):
        """"""

        # TODO: Do the same for duration/timedelta
        if "timestamp" in self:
            self._check_timestamp()
            if type(self["timestamp"]) == list:
                def datetime_to_string(dt):
                    return fmt_datetime(dt) if type(dt) == datetime else dt
                self["timestamp"] = list(map(datetime_to_string, self["timestamp"]))
            elif type(self["timestamp"]) == datetime:
                self["timestamp"] = fmt_datetime(self["timestamp"])

        # FIXME: Support list of volumes
        if "volume" in self:
            self["volume"]["unit"] = self["volume"]["unit"].replace("l", "L")

        # FIXME: Support list of weights
        if "weight" in self:
            # Zenobase uses "ug" for micrograms
            if self["weight"]["unit"] in ["mcg", "µg"]:
                self["weight"]["unit"] = "ug"
832789
protected void cleanup() {
    // Clean-up global list of temporary vectors
    Futures fs = new Futures();
    cleanupTrash(_gVecTrash, fs);
    cleanupTrash(_lVecTrash, fs);
    fs.blockForPending();
  }
569908
private void clean(int from, int to) {
        for (int i = from; i < to; i++) {
            ByteBuffer bb = segments.get(i);
            cleanMappedByteBuffer(bb);
            segments.set(i, null);
        }
    }
1364260
@Override
  public void cleanupSession(long sessionId) {
    Set<Long> blockIds;
    try (LockResource lr = new LockResource(mLock)) {
      blockIds = mSessionIdToBlockIds.get(sessionId);
      if (blockIds == null) {
        return;
      }
    }
    // Note that, there can be a race condition that blockIds can be stale when we release the
    // access. The race condition only has a minimal negative consequence (printing extra logging
    // message), and is expected very rare to trigger.
    for (Long blockId : blockIds) {
      try {
        // Note that we don't need to explicitly call abortBlock to cleanup the temp block
        // in Local block store because they will be cleanup by the session cleaner in the
        // Local block store.
        closeReaderOrWriter(sessionId, blockId);
        releaseAccess(sessionId, blockId);
      } catch (Exception e) {
        LOG.warn("Failed to cleanup UFS block {}, session {}.", blockId, sessionId);
      }
    }
  }
48410
def _ctypes_clean(parameter):
    
    if ("out" in parameter.direction and parameter.dimension is not None
        and ":" in parameter.dimension and ("pointer" in parameter.modifiers or
                                            "allocatable" in parameter.modifiers)):
        params = parameter.ctypes_parameter()
        result = []
        spacer = "    "
        #We get segfaults if we try to assign c-pointers to unallocated pointers or arrays.
        if "optional" in parameter.modifiers:
            if "pointer" in parameter.modifiers:
                result.append("{}if (associated({})) then".format(spacer, parameter.name))
                spacer += "  "
            elif "allocatable" in parameter.modifiers:
                result.append("{}if (allocated({})) then".format(spacer, parameter.name))
                spacer += "  "

        #We have to copy the values or at least update the pointer to access the
        #variables with 'target' and 'save' attributes.
        result.append("{0}{1}_t = {1}".format(spacer, parameter.name))
            
        if parameter.direction == "(inout)":
            result.append("{1}{0}_o = C_LOC({0}_t)".format(parameter.name, spacer))
            #Update the index variables for the dimensions of the output variable.
            for i, p in enumerate(params[1:-1]):
                result.append("{}{} = size({}, {})".format(spacer, p, parameter.name, i+1))
        else:
            #This is the case for intent(out)
            result.append("{1}{0}_c = C_LOC({0}_t)".format(parameter.name, spacer))
            for i, p in enumerate(params[1::]):
                result.append("{}{} = size({}, {})".format(spacer, p, parameter.name, i+1))

        if ("optional" in parameter.modifiers and
            ("pointer" in parameter.modifiers or "allocatable" in parameter.modifiers)):
            result.append("    end if")

        return ('\n'.join(result), True)
    elif parameter.dtype == "logical" and "out" in parameter.direction:
        return ("    {0}_c = {0}".format(parameter.name), False)
839509
function cleanUpData(data) {
  if (!(data instanceof Tag$1) && !(data && isFunction(data.trigger)))
    { return data }

  var o = {};
  for (var key in data) {
    if (!RE_RESERVED_NAMES.test(key)) { o[key] = data[key]; }
  }
  return o
}
1000167
def clean(dry_run='n'):
    """"""
    file_patterns = ['*.pyc', '*.pyo', '*~']
    dir_patterns = ['__pycache__']
    recursive_pattern_delete(project_paths.root, file_patterns, dir_patterns, dry_run=bool(dry_run.lower() == 'y'))