Calculates the total memory of the device. This is based on an inspection of the filesystem, which in android devices is stored in RAM.

@return Total number of bytes.
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;
    }
677473
def get_memory_usage():
    
    process = psutil.Process(os.getpid())
    mem = process.memory_info().rss
    return mem / (1024 * 1024)
652520
private static long getSizeOfPhysicalMemoryForMac() {

		BufferedReader bi = null;

		try {
			Process proc = Runtime.getRuntime().exec("sysctl hw.memsize");

			bi = new BufferedReader(
					new InputStreamReader(proc.getInputStream()));

			String line;

			while ((line = bi.readLine()) != null) {
				if (line.startsWith("hw.memsize")) {
					long memsize = Long.parseLong(line.split(":")[1].trim());
					bi.close();
					proc.destroy();
					return memsize;
				}
			}

		} catch (Exception e) {
			LOG.error(e);
			return -1;
		} finally {
			if (bi != null) {
				try {
					bi.close();
				} catch (IOException ioe) {
				}
			}
		}
		return -1;
	}
213017
def getTotalCpuTimeAndMemoryUsage():
    
    me = resource.getrusage(resource.RUSAGE_SELF)
    childs = resource.getrusage(resource.RUSAGE_CHILDREN)
    totalCpuTime = me.ru_utime+me.ru_stime+childs.ru_utime+childs.ru_stime
    totalMemoryUsage = me.ru_maxrss+ me.ru_maxrss
    return totalCpuTime, totalMemoryUsage
1362066
public final int size()
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "size");
    int result = (m_tail >= m_head) ? (m_tail - m_head) : (m_array.length - m_head + m_tail);
    if (tc.isEntryEnabled())
      SibTr.exit(tc, "size", new Integer(result));
    return result;
  }
841527
protected static Long getTotalInternalStorage() {
        try {
            File path = Environment.getDataDirectory();
            StatFs stat = new StatFs(path.getPath());
            long blockSize = stat.getBlockSize();
            long totalBlocks = stat.getBlockCount();
            return totalBlocks * blockSize;
        } catch (Exception e) {
            Log.e(TAG, "Error getting total internal storage amount.", e);
            return null;
        }
    }
988105
public synchronized int getSize() {
        try {
            ByteArrayOutputStream bOut = new ByteArrayOutputStream();
            ObjectOutputStream oOut = new ObjectOutputStream(bOut);
            oOut.writeObject(historyStore);
            bOut.close();
            return bOut.size();
        } catch (IOException e) {
            throw new IllegalStateException("Cannot serialize internal store: " + e,e);
        }
    }
668202
public String getMemoryUsageAsString() {
        long len = weights.length;
        return ((8L + 4L + 4L) * len
                + changedNodes.getCapacity() * 4L
                + heap.getCapacity() * (4L + 4L)) / Helper.MB
                + "MB";
    }
1009561
public com.google.protobuf.ByteString
      getDeviceBytes() {
    java.lang.Object ref = device_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      device_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }
83761
private void calculateUploadedAndTotalBytes() {
        uploadedBytes = 0;

        for (String filePath : getSuccessfullyUploadedFiles()) {
            uploadedBytes += new File(filePath).length();
        }

        totalBytes = uploadedBytes;

        for (UploadFile file : params.files) {
            totalBytes += file.length(service);
        }
    }
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;
    }
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;
    }
880860
public int getTotalFree(){
		int total=0;
		for (int i=0; i < this.partitionCount && this.partitions[i] != null ; i++){
			total+=this.partitions[i].getAvailableConnections();
		}
		return total;
	}
1104588
public function getMemoryUsage()
    {
        if (empty($this->endMemory)) {
            $this->stop();
        }

        return $this->getFormattedMemorySize($this->endMemory - $this->startMemory);
    }
141441
public function calcResourceMemorySize(): int {
		$imageData = getimagesize($this->filePath);
		
		return round(($imageData[0] * $imageData[1] * $imageData['bits'] * $imageData['channels'] / 8));
	}
387312
@Override
    public int getInMemoryDataSize()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "getInMemoryDataSize");

        JsMessage localMsg = getJSMessage(true);
        int msgSize = localMsg.getInMemorySize();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "getInMemoryDataSize", Integer.valueOf(msgSize));

        return msgSize;
    }
746924
public long getTotalSpace() {
        try {
            StructStatVfs sb = Libcore.os.statvfs(path);
            return sb.f_blocks * sb.f_bsize; // total block count * block size in bytes.
        } catch (ErrnoException errnoException) {
            return 0;
        }
    }