Returns how much revocable memory will be revoked by the operator
199384
public long requestMemoryRevoking()
    {
        long revokedMemory = 0L;
        Runnable listener = null;
        synchronized (this) {
            if (!isMemoryRevokingRequested() && operatorMemoryContext.getRevocableMemory() > 0) {
                memoryRevokingRequested = true;
                revokedMemory = operatorMemoryContext.getRevocableMemory();
                listener = memoryRevocationRequestListener;
            }
        }
        if (listener != null) {
            runListener(listener);
        }
        return revokedMemory;
    }
1033722
private int getSlotCount(int memory, int vcores) {
        int cpuports = (int) Math.ceil(vcores / JOYConstants.JSTORM_VCORE_WEIGHT);
        int memoryports = (int) Math.floor(memory / JOYConstants.JSTORM_MEMORY_WEIGHT);
//        return cpuports > memoryports ? memoryports : cpuports;
        return memoryports;
    }
1170770
def ndeleted(self):
        """"""
        if not self._counters_calculated:
            self._counters_calculated = True
            self._extract_counters()

        return self._ndeleted
744827
def get_cur_mem_use():
    """"""
    # http://lwn.net/Articles/28345/

    lines = open("/proc/meminfo", 'r').readlines()
    emptySpace = re.compile('[ ]+')
    for line in lines:
        if "MemTotal" in line:
            memtotal = float(emptySpace.split(line)[1])
        if "SwapFree" in line:
            swapfree = float(emptySpace.split(line)[1])
        if "SwapTotal" in line:
            swaptotal = float(emptySpace.split(line)[1])
        if "MemFree" in line:
            memfree = float(emptySpace.split(line)[1])
        if "Cached" in line and not "SwapCached" in line:
            cached = float(emptySpace.split(line)[1])

    ramoccup = 1.0 - (memfree + cached) / memtotal
    if swaptotal == 0:
        swapoccup = 0
    else:
        swapoccup = 1.0 - swapfree / swaptotal
    strramoccup = str(round(ramoccup * 100.0, 1))
    strswapoccup = str(round(swapoccup * 100.0, 1))

    return float(memtotal), strramoccup, strswapoccup
315028
private static long discard(ByteBuf buffer, long remainingToDiscard)
    {
        int availableToDiscard = (int) Math.min(remainingToDiscard, buffer.readableBytes());
        buffer.skipBytes(availableToDiscard);
        return remainingToDiscard - availableToDiscard;
    }
395591
private void discardReadBytesIfNecessary(ByteBuf buffer) {

        float usedRatio = (float) buffer.readerIndex() / buffer.capacity();

        if (usedRatio >= discardReadBytesRatio && buffer.refCnt() != 0) {
            buffer.discardReadBytes();
        }
    }
514545
private void returnMemorySegment(MemorySegment segment) {
		assert Thread.holdsLock(availableMemorySegments);

		numberOfRequestedMemorySegments--;
		networkBufferPool.recycle(segment);
	}
495847
def get_free_memory_win():
    
    stat = MEMORYSTATUSEX()
    ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat))
    return int(stat.ullAvailPhys / 1024 / 1024)
129450
def num_discarded(self):
    """"""
    if not self._data:
      return 0
    n = 0
    while n < len(self._data):
      if not isinstance(self._data[n], _TensorValueDiscarded):
        break
      n += 1
    return n
10396
protected function memoryExceeded()
    {
        static $warning_percent = 0.5;

        $percent = (memory_get_usage() / 1024 / 1024) / $this->memoryLimit;

        if ($percent >= $warning_percent) {
            $this->log(sprintf('Memory usage at %d%% (Max %s MB)', round($percent * 100, 1), $this->memoryLimit), Logger::DEBUG);
            $warning_percent = ceil(($percent * 100) / 10) * 10 / 100;
        }

        return $percent > 0.999;
    }
871981
private int slopSize(Versioned<Slop> slopVersioned) {
        int nBytes = 0;
        Slop slop = slopVersioned.getValue();
        nBytes += slop.getKey().length();
        nBytes += ((VectorClock) slopVersioned.getVersion()).sizeInBytes();
        switch(slop.getOperation()) {
            case PUT: {
                nBytes += slop.getValue().length;
                break;
            }
            case DELETE: {
                break;
            }
            default:
                logger.error("Unknown slop operation: " + slop.getOperation());
        }
        return nBytes;
    }
160146
def last_code
		data_ffi = ::FFI::MemoryPointer.new(:uchar, 16)
		
		data_length = ::FFI::MemoryPointer.new(:int)
		data_length.write_int(16)

		bit_count = ::FFI::MemoryPointer.new(:int)
		
		Klass.getLastCode(@handle, data_ffi, data_length, bit_count)

		data = []
		
		data_length.get_int(0).times { |i|
			 data << data_ffi[i].get_uchar(0).to_s(16)
		}
		
      [data, data_length.get_int(0), bit_count.get_int(0)]

    end
1329461
public long getReveseDNSCacheLifetime()
            throws NumberFormatException {

        long value = 60*60*1000;

        String property = getProperty(REVERSE_DNS_CACHE_LIFETIME);
        if (property != null && property.length() > 0) {
            long parsedValue = Long.parseLong(property);
            if (parsedValue > 0) {
                value = parsedValue;
            }
        }

        // System property takes precedence
        property = System.getProperty(REVERSE_DNS_CACHE_LIFETIME);
        if (property != null && property.length() > 0) {
            long parsedValue = Long.parseLong(property);
            if (parsedValue > 0) {
                value = parsedValue;
            }
        }

        return value;
    }
1062116
function _revokedCertificate(&$rclist, $serial, $create = false)
    {
        $serial = new Math_BigInteger($serial);

        foreach ($rclist as $i => $rc) {
            if (!($serial->compare($rc['userCertificate']))) {
                return $i;
            }
        }

        if (!$create) {
            return false;
        }

        $i = count($rclist);
        $rclist[] = array('userCertificate' => $serial,
                          'revocationDate'  => $this->_timeField(@date('D, d M Y H:i:s O')));
        return $i;
    }
716377
def clear
      return self unless current_table = table
      current_table_size = current_table.size
      deleted_count = i = 0
      while i < current_table_size
        if !(node = current_table.volatile_get(i))
          i += 1
        elsif (node_hash = node.hash) == MOVED
          current_table      = node.key
          current_table_size = current_table.size
        elsif Node.locked_hash?(node_hash)
          decrement_size(deleted_count) # opportunistically update count
          deleted_count = 0
          node.try_await_lock(current_table, i)
        else
          current_table.try_lock_via_hash(i, node, node_hash) do
            begin
              deleted_count += 1 if NULL != node.value # recheck under lock
              node.value = nil
            end while node = node.next
            current_table.volatile_set(i, nil)
            i += 1
          end
        end
      end
      decrement_size(deleted_count)
      self
    end
184145
public PerformUsage getJVMMemoryUsage() {
        int mb = 1024 * 1024;
        Runtime rt = Runtime.getRuntime();
        PerformUsage usage = new PerformUsage();
        usage.totalMemory = (double) rt.totalMemory() / mb;
        usage.freeMemory = (double) rt.freeMemory() / mb;
        usage.usedMemory = (double) rt.totalMemory() / mb - rt.freeMemory()
                / mb;
        usage.maxMemory = (double) rt.maxMemory() / mb;
        usage.memoryUsagePercent = usage.usedMemory / usage.maxMemory * 100.0;

        // update current
        currentJvmPerformUsage = usage;
        return usage;
    }
774011
def _decrement_current_byte(self):
        
        # If the current byte is uninitialized, then decrementing it will make it the max cell size
        # Otherwise, if it's already at the minimum cell size, then it will also make it the max cell size
        if self.tape[self.pointer] is None or self.tape[self.pointer] == self.MIN_CELL_SIZE:
            self.tape[self.pointer] = self.MAX_CELL_SIZE
        else:  # decrement it
            self.tape[self.pointer] -= 1