Returns True if our memory footprint is too large.
482147
def MemoryExceeded(self):
    """"""
    rss_size = self.proc.memory_info().rss
    return rss_size // 1024 // 1024 > config.CONFIG["Client.rss_max"]
969091
@Trivial
    public synchronized boolean isFull() {
        // final String methodName = "isFull()";
        boolean isFull = false;
        int size = this.explicitBuffer.size() + this.scanBuffer.size() + this.garbageCollectorBuffer.size();
        if (size > this.maxInvalidationBufferSize || (System.currentTimeMillis() - this.lastRemoveTime) >= this.maxInvalidationBufferLife) {
            isFull = true;
            setlastRemoveTime();
        }
        // if (isFull) {
        // traceDebug(methodName, "cacheName=" + this.cod.cacheName + " isFull=" + isFull + " explicitBuffer=" +
        // explicitBuffer.size() + " scanBuffer=" + this.scanBuffer.size());
        // }
        return isFull;
    }
327753
public boolean containsLong(long value) {
		for (int i = 1; i < maxPoolSize; i++) {
			if (types[i] == LONG && readLong(i) == value) return true;
		}
		return false;
	}
213799
private boolean shouldBeLogged(ExtendedLogEntry logEntry, OSGiTraceComponent tc) {
        String message = logEntry.getMessage().toLowerCase();
        if(message.contains(COULD_NOT_GET_SERVICE_FROM_REF) ||
                message.contains(COULD_NOT_OBTAIN_ALL_REQ_DEPS) ||
                message.contains(SERVICE_NOT_AVAILABLE)) {
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "This is not an error, but may indicate high system load - " + logEntry.getMessage(),
                        getObjects(logEntry, false));
            }
            return false;
        }
        return true;
    }
569560
static long checkPreambleSize(final Memory mem) {
    final long cap = mem.getCapacity();
    if (cap < 8) { throwNotBigEnough(cap, 8); }
    final long pre0 = mem.getLong(0);
    final int preLongs = (int) (pre0 & 0X3FL); //lower 6 bits
    final int required = Math.max(preLongs << 3, 8);
    if (cap < required) { throwNotBigEnough(cap, required); }
    return pre0;
  }
274231
public boolean contains(long index) {
    assertSegmentOpen();

    if (!validIndex(index))
      return false;

    // Check the memory index first for performance reasons.
    long offset = relativeOffset(index);
    return offsetIndex.contains(offset);
  }
1257564
def is_full(self):
        
        if len(self.grid) == 0:
            return False

        for i in range(len(self.grid)):
            for j in range(len(self.grid[0])):
                if self.grid[i][j] is None:
                    return False
        return True
42862
public void assertMemoryNotLow() {
		ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
		((ActivityManager)activityUtils.getCurrentActivity().getSystemService("activity")).getMemoryInfo(mi);
		Assert.assertFalse("Low memory available: " + mi.availMem + " bytes!", mi.lowMemory);
	}
567034
def check_mem_usage(soft_percent=None, hard_percent=None):
    
    soft_percent = soft_percent or config.memory.soft_mem_limit
    hard_percent = hard_percent or config.memory.hard_mem_limit
    used_mem_percent = psutil.virtual_memory().percent
    if used_mem_percent > hard_percent:
        raise MemoryError('Using more memory than allowed by configuration '
                          '(Used: %d%% / Allowed: %d%%)! Shutting down.' %
                          (used_mem_percent, hard_percent))
    elif used_mem_percent > soft_percent:
        msg = 'Using over %d%% of the memory in %s!'
        return msg % (used_mem_percent, socket.gethostname())
1322050
def get_memory_size(self):
        """"""
        n = sys.getsizeof(self)
        n += sys.getsizeof(self.padding)
        n += total_size(self.start_addr)
        n += total_size(self._buf)
        n += sys.getsizeof(self._offset)
        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;
    }
699169
protected function process_memory_info()
    {

        $this->current_mem_use     = (int)memory_get_usage();
        $this->current_mem_peak    = (int)memory_get_peak_usage();
        $this->current_mem_peak_mb = (float)$this->current_mem_peak / 1024 / 1024;
        $this->current_mem_use_mb  = (float)$this->current_mem_use / 1024 / 1024;

        return true;
    }
206739
protected void checkMapSize()
  {
    if ((map instanceof EmbeddedSlotMap) && map.size() >= LARGE_HASH_SIZE) {
      SlotMap newMap = new HashSlotMap();
      for (Slot s : map) {
        newMap.addSlot(s);
      }
      map = newMap;
    }
  }
409534
private boolean hasEnoughDiskSpace(ClusterNode node) {
    int total = node.getTotal().diskGB;
    int free = node.getFree().diskGB;
    if (free < nodeReservedDiskGB) {
      if (LOG.isDebugEnabled()) {
        LOG.debug(node.getHost() + " not enough disk space." +
          " totalMB:" + total +
          " free:" + free +
          " limit:" + nodeReservedDiskGB);
      }
      return false;
    }
    return true;
  }
356449
def verify_space_available(self, search_pattern=r"(\d+) \w+ free"):
        """"""
        if self.direction == "put":
            space_avail = self.remote_space_available(search_pattern=search_pattern)
        elif self.direction == "get":
            space_avail = self.local_space_available()
        if space_avail > self.file_size:
            return True
        return False
723207
public static boolean isFileSizeUnderLimit(ByteSizeValue limit, long fileSizeAsBytes) {
        boolean result = true;
        if (limit != null) {
            // We check the file size to avoid indexing too big files
            ByteSizeValue fileSize = new ByteSizeValue(fileSizeAsBytes);
            int compare = fileSize.compareTo(limit);
            result = compare <= 0;
            logger.debug("Comparing file size [{}] with current limit [{}] -> {}", fileSize, limit,
                    result ? "under limit" : "above limit");
        }

        return result;
    }
918895
def memory_warning(config, context):
    """"""
    used = psutil.Process(os.getpid()).memory_info().rss / 1048576
    limit = float(context.memory_limit_in_mb)
    p = used / limit

    memory_threshold = config.get('memory_warning_threshold')

    if p >= memory_threshold:
        config['raven_client'].captureMessage(
            'Memory Usage Warning',
            level='warning',
            extra={
                'MemoryLimitInMB': context.memory_limit_in_mb,
                'MemoryUsedInMB': math.floor(used)
            }
        )
    else:
        # nothing to do check back later
        Timer(.5, memory_warning, (config, context)).start()