Represents the amount of memory (in bytes) that is guaranteed to be available for use by the Java virtual machine.
The amount of committed memory may change over time (increase or decrease).

@return memory
483523
public static long committedMemory() {
        long memory = 0;
        for (MemoryPoolMXBean mp : ManagementFactory.getMemoryPoolMXBeans()) {
            memory += mp.getUsage().getUsed();
        }
        return memory;
    }
414613
private static long getSizeOfFreeMemory() {
		float fractionToUse = GlobalConfiguration.getFloat(
			ConfigConstants.TASK_MANAGER_MEMORY_FRACTION_KEY, ConfigConstants.DEFAULT_MEMORY_MANAGER_MEMORY_FRACTION);
		
		Runtime r = Runtime.getRuntime();
		long max = r.maxMemory();
		long total = r.totalMemory();
		long free = r.freeMemory();
		
		long available = max - total + free;
		return (long) (fractionToUse * available);
	}
1112169
private long getMemoryUsage() {
    long totalPageSize = 0;
    for (MemoryBlock page : allocatedPages) {
      totalPageSize += page.size();
    }
    return ((inMemSorter == null) ? 0 : inMemSorter.getMemoryUsage()) + totalPageSize;
  }
1270371
public String getHealthMemory() {
        StringBuilder sb = new StringBuilder();
        sb.append("Logging JVM Stats\n");
        MonitorProvider mp = MonitorProvider.getInstance();
        PerformUsage perf = mp.getJVMMemoryUsage();
        sb.append(perf.toString());

        if (perf.memoryUsagePercent >= THRESHOLD_PERCENT) {
            sb.append("========= WARNING: MEM USAGE > " + THRESHOLD_PERCENT
                    + "!!");
            sb.append(" !! Live Threads List=============\n");
            sb.append(mp.getThreadUsage().toString());
            sb.append("========================================\n");
            sb.append("========================JVM Thread Dump====================\n");
            ThreadInfo[] threadDump = mp.getThreadDump();
            for (ThreadInfo threadInfo : threadDump) {
                sb.append(threadInfo.toString() + "\n");
            }
            sb.append("===========================================================\n");
        }
        sb.append("Logged JVM Stats\n");

        return sb.toString();
    }
1287176
public int getVInt() {
		int value = 0;
		for (int i = 0; i <= 32; i += 7) {
			final byte b = getByte();
			value |= ((b & 0x7FL) << i);
			if (b >= 0)
				return value;
		}
		return value;
	}
1280240
public function getMemoryUsage()
    {
        $size = memory_get_usage(true);
        $unit = array('b','kb','mb','gb','tb','pb');
                
        return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
    }
107417
public function getFillingPercentage()
    {
        $mem = apc_sma_info(true);
        $memSize    = $mem['num_seg'] * $mem['seg_size'];
        $memAvailable= $mem['avail_mem'];
        $memUsed = $memSize - $memAvailable;
        if ($memSize == 0) {
            Zend_Cache::throwException('can\'t get apc memory size');
        }
        if ($memUsed > $memSize) {
            return 100;
        }
        return ((int) (100. * ($memUsed / $memSize)));
    }
132373
protected function getSystemMemoryInfo()
    {
        $meminfo = array();

        if (file_exists(static::MEMINFO_PATH)) {
            $data = explode("\n", file_get_contents(static::MEMINFO_PATH));
            $meminfo = array();
            foreach ($data as $line) {
                if (!empty($line)) {
                    list($key, $val) = explode(":", $line);

                    $meminfo[$key] = intval($val);
                }
            }
        }

        return $meminfo;
    }
217876
public long getMemoryUsageBytes() {
    long total = 0;
    for (int i = 0; i < maps_.length; i++) {
      if (maps_[i] != null) {
        total += maps_[i].getMemoryUsageBytes();
      }
    }
    return total;
  }
1014826
public function getSize()
    {
        if ($this->size === null && $this->storage->supportsSize()) {
            $this->size = $this->storage->getSize($this->key);
        }

        return $this->size;
    }
1030968
protected function getMemoryUsageString()
    {
        switch (strtoupper(trim(ShopgateLogger::getInstance()->getMemoryAnalyserLoggingSizeUnit()))) {
            case 'GB':
                return (memory_get_usage() / (1024 * 1024 * 1024)) . " GB (real usage " . (memory_get_usage(
                            true
                        ) / (1024 * 1024 * 1024)) . " GB)";
            case 'MB':
                return (memory_get_usage() / (1024 * 1024)) . " MB (real usage " . (memory_get_usage(
                            true
                        ) / (1024 * 1024)) . " MB)";
            case 'KB':
                return (memory_get_usage() / 1024) . " KB (real usage " . (memory_get_usage(true) / 1024) . " KB)";
            default:
                return memory_get_usage() . " Bytes (real usage " . memory_get_usage(true) . " Bytes)";
        }
    }
1006402
private MemoryMappedPE getMemoryMappedPE() {
        if (!memoryMapped.isPresent()) {
            memoryMapped = Optional.of(MemoryMappedPE.newInstance(data, this));
        }
        return memoryMapped.get();
    }
502105
private long getTotalInternalMemorySize() {
        final File path = Environment.getDataDirectory();
        final StatFs stat = new StatFs(path.getPath());
        final long blockSize;
        final long totalBlocks;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
            blockSize = stat.getBlockSizeLong();
            totalBlocks = stat.getBlockCountLong();
        } else {
            //noinspection deprecation
            blockSize = stat.getBlockSize();
            //noinspection deprecation
            totalBlocks = stat.getBlockCount();
        }
        return totalBlocks * blockSize;
    }
122128
public static double getUsedMemory() {
    	Runtime rt = Runtime.getRuntime();
    	
    	long memLong = rt.totalMemory() - rt.freeMemory();
    	double memDouble = memLong / (1024.0 * 1024.0);
    	memDouble = Math.round(memDouble * 100) / 100.0;
    	return memDouble;
    }
578482
protected function outputMemoryUsage()
    {
        $memory = memory_get_usage(true);

        $unit = array('B', 'KB', 'MB', 'GB', 'TB', 'PB');
        $memory = round($memory / pow(1024, ($i = floor(log($memory, 1024)))), 2) . ' ' . $unit[$i];

        $this->output('Memory usage: ' . $memory, self::OUTPUT_COMMENT);
    }
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;
    }
552639
public function retrieveTotalMemoryUsage()
    {
        $base = $this->retrieve(0);
        $total = $last = 0;

        foreach ($this->retrieve() as $item) {
            $total += max(0, (($item[5]-$base[5]) - $last));
            $last = $item[5]-$base[5];
        }

        return $total;
    }