Returns memory available for use in k as an int
341167
def get_memory(self,
	               shutit_pexpect_child=None,
	               note=None):
		""""""
		shutit_global.shutit_global_object.yield_to_draw()
		shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_child
		shutit_pexpect_session = self.get_shutit_pexpect_session_from_child(shutit_pexpect_child)
		return shutit_pexpect_session.get_memory(note=note)
989880
def get_total_memory():
    """"""
    if platform.system() != "Linux":
        return None

    with open("/proc/meminfo", "r") as in_file:
        for line in in_file:
            info = line.split()
            if info[0] == "MemTotal:" and info[-1] == "kB":
                memory_mb = int(int(info[1]) / 1024)
                return memory_mb

    return None
266728
def get_memfree(memory, parallel):
  """"""
  number = int(memory.rstrip(string.ascii_letters))
  memtype = memory.lstrip(string.digits)
  if not memtype:
    memtype = "G"
  return "%d%s" % (number*parallel, memtype)
1262874
def prettyMemory(k, field=None, isBytes=False):
    
    if isBytes:
        k /= 1024
    if k < 1024:
        return padStr("%gK" % k, field)
    if k < (1024 * 1024):
        return padStr("%.1fM" % (old_div(k, 1024.0)), field)
    if k < (1024 * 1024 * 1024):
        return padStr("%.1fG" % (k / 1024.0 / 1024.0), field)
    if k < (1024 * 1024 * 1024 * 1024):
        return padStr("%.1fT" % (k / 1024.0 / 1024.0 / 1024.0), field)
    if k < (1024 * 1024 * 1024 * 1024 * 1024):
        return padStr("%.1fP" % (k / 1024.0 / 1024.0 / 1024.0 / 1024.0), field)
900897
def _SI(size, K=1024, i='i'):
    '''
    '''
    if 1 < K < size:
        f = float(size)
        for si in iter('KMGPTE'):
            f /= K
            if f < K:
                return ' or %.1f %s%sB' % (f, si, i)
    return ''
696708
@Override
  public long getAllocatedMemory() {
    long sum = 0;
    for (MapInternals m : segments) {
      sum += m.getAllocatedMemory();
    }
    return sum;
  }
342432
def memory():
    

    mem_info = dict()

    for k, v in psutil.virtual_memory()._asdict().items():
           mem_info[k] = int(v)
           
    return mem_info
403948
def any2mb(s):
    """"""
    if is_string(s):
        return int(Memory.from_string(s).to("Mb"))
    else:
        return int(s)
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;
    }
325814
def ingest_memory(self, memory):
        
        def lshift(num, shift):
            return num << shift

        def rshift(num, shift):
            return num >> shift

        if isinstance(memory, int):
            # Memory was specified as an integer, meaning it is in bytes
            memory = '{}b'.format(memory)

        bit_shift = {
            'g': {'func': lshift, 'shift': 30},
            'm': {'func': lshift, 'shift': 20},
            'k': {'func': lshift, 'shift': 10},
            'b': {'func': rshift, 'shift': 0}
        }
        unit = memory[-1]
        number = int(memory[:-1])
        return bit_shift[unit]['func'](number, bit_shift[unit]['shift'])
908371
def getint(self, key, **kwargs):
        

        return self.get(key, cast_func=int, **kwargs)
7844
def GetUsedMemory(self):
    
    try:
      memory_info = self._process.memory_info()
    except psutil.NoSuchProcess:
      return None

    # Psutil will return different memory information depending on what is
    # available in that platform.
    memory_data = getattr(memory_info, 'data', 0)
    memory_shared = getattr(memory_info, 'shared', 0)

    return memory_data + memory_shared
422163
public synchronized int allocateNextChunk() {
        if ((used_bytes.longValue() + (long) mem_chunksize) > max_allowed_bytes) {
            logger.info("No memory left");
            return 0;
        }
        used_bytes.set(used_bytes.longValue() + (long) mem_chunksize);
        return mem_chunksize;
    }
96173
def get_memory(self, start, size):
        
        LOG.debug('get_memory: %d bytes from %x', size, start)
        return get_memory(self.ida.idaapi, start, size,
                          default_byte=self.default_byte)
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
314459
private static final int gatherPartialIntLE(final byte[] data, final int index, final int available) {
        int i = data[index] & 0xFF;

        if(available > 1) {
            i |= (data[index + 1] & 0xFF) << 8;
            if(available > 2) {
                i |= (data[index + 2] & 0xFF) << 16;
            }
        }

        return i;
    }
72357
private int allocate(int size)
    {
        while (true)
        {
            int prev = allocatePosition.get();
            int next = prev + size;
            if (next >= buffer.capacity())
                return -1;
            if (allocatePosition.compareAndSet(prev, next))
                return prev;
        }
    }