Get the base OS page size (this current Java process may not
necessarily be using this page size). Not implemented on Windows.

@return Page size.
@throws OperatingSystemException Error computing page size.
550145
public static synchronized int getPageSize() throws OperatingSystemException {
        if (cachedPageSize == -1) {
            switch (instance().getOperatingSystemType()) {
                case AIX:
                case HPUX:
                case IBMi:
                case Linux:
                case Mac:
                case Solaris:
                case zOS:
                    cachedPageSize = getPageSizePOSIX();
                    break;
                default:
                    throw new OperatingSystemException(Tr.formatMessage(tc, "os.pagesize.unavailable"));
            }
        }
        return cachedPageSize;
    }
556216
public int getDocumentSize() {
    if (SourceDocumentInformation_Type.featOkTst && ((SourceDocumentInformation_Type)jcasType).casFeat_documentSize == null)
      jcasType.jcas.throwFeatMissing("documentSize", "org.apache.uima.examples.SourceDocumentInformation");
    return jcasType.ll_cas.ll_getIntValue(addr, ((SourceDocumentInformation_Type)jcasType).casFeatCode_documentSize);}
814285
@SuppressWarnings("resource")
	private static long getSizeOfPhysicalMemoryForLinux() {
		BufferedReader lineReader = null;
		try {
			lineReader = new BufferedReader(new FileReader(LINUX_MEMORY_INFO_PATH));

			String line = null;
			while ((line = lineReader.readLine()) != null) {
				Matcher matcher = LINUX_MEMORY_REGEX.matcher(line);
				if (matcher.matches()) {
					String totalMemory = matcher.group(1);
					return Long.parseLong(totalMemory) * 1024L; // Convert from kilobyte to byte
				}
			}
			
			// expected line did not come
			LOG.error("Cannot determine the size of the physical memory using '/proc/meminfo'. Unexpected format.");
			return -1;
		}
		catch (NumberFormatException e) {
			LOG.error("Cannot determine the size of the physical memory using '/proc/meminfo'. Unexpected format.");
			return -1;
		}
		catch (IOException e) {
			LOG.error("Cannot determine the size of the physical memory using '/proc/meminfo': " + e.getMessage(), e);
			return -1;
		}
		finally {
			// Make sure we always close the file handle
			try {
				if (lineReader != null) {
					lineReader.close();
				}
			} catch (Throwable t) {}
		}
	}
1112169
private long getMemoryUsage() {
    long totalPageSize = 0;
    for (MemoryBlock page : allocatedPages) {
      totalPageSize += page.size();
    }
    return ((inMemSorter == null) ? 0 : inMemSorter.getMemoryUsage()) + totalPageSize;
  }
571883
@Override
    public int size() {
        Node h = putStack.get();
        int putStackSize = h == null ? 0 : h.size;
        return putStackSize + takeStackSize.get();
    }
441800
public int getSerializedSize() {
    int size = 0;
    for (int i = 0; i < fields.getNumArrayEntries(); i++) {
      final Map.Entry<FieldDescriptorType, Object> entry =
          fields.getArrayEntryAt(i);
      size += computeFieldSize(entry.getKey(), entry.getValue());
    }
    for (final Map.Entry<FieldDescriptorType, Object> entry :
         fields.getOverflowEntries()) {
      size += computeFieldSize(entry.getKey(), entry.getValue());
    }
    return size;
  }
246400
@Nonnegative
  public long getSize ()
  {
    if (m_nSize >= 0)
      return m_nSize;
    if (m_aCachedContent != null)
      return m_aCachedContent.length;
    if (m_aDFOS.isInMemory ())
      return m_aDFOS.getDataLength ();
    return m_aDFOS.getFile ().length ();
  }
1058835
public static int getPageSize(Configuration configuration) {
		final int pageSize = checkedDownCast(MemorySize.parse(
			configuration.getString(TaskManagerOptions.MEMORY_SEGMENT_SIZE)).getBytes());

		// check page size of for minimum size
		ConfigurationParserUtils.checkConfigParameter(pageSize >= MemoryManager.MIN_PAGE_SIZE, pageSize,
			TaskManagerOptions.MEMORY_SEGMENT_SIZE.key(),
			"Minimum memory segment size is " + MemoryManager.MIN_PAGE_SIZE);
		// check page size for power of two
		ConfigurationParserUtils.checkConfigParameter(MathUtils.isPowerOf2(pageSize), pageSize,
			TaskManagerOptions.MEMORY_SEGMENT_SIZE.key(),
			"Memory segment size must be a power of 2.");

		return pageSize;
	}
96607
public static int getTotalPhysicalMemorySizeInMB() {

    int memorySizeInMB;
    try {
      long memorySizeInBytes = ((com.sun.management.OperatingSystemMXBean) ManagementFactory
                    .getOperatingSystemMXBean()).getTotalPhysicalMemorySize();

      memorySizeInMB = (int) (memorySizeInBytes / BYTES_IN_MEGABYTE);
    } catch (Exception e) {
      memorySizeInMB = -1;
    }

    return memorySizeInMB;
  }
399926
public static long getManagedMemorySize(Configuration configuration) {
		long managedMemorySize;
		String managedMemorySizeDefaultVal = TaskManagerOptions.MANAGED_MEMORY_SIZE.defaultValue();
		if (!configuration.getString(TaskManagerOptions.MANAGED_MEMORY_SIZE).equals(managedMemorySizeDefaultVal)) {
			try {
				managedMemorySize = MemorySize.parse(
					configuration.getString(TaskManagerOptions.MANAGED_MEMORY_SIZE), MEGA_BYTES).getMebiBytes();
			} catch (IllegalArgumentException e) {
				throw new IllegalConfigurationException("Could not read " + TaskManagerOptions.MANAGED_MEMORY_SIZE.key(), e);
			}
		} else {
			managedMemorySize = Long.valueOf(managedMemorySizeDefaultVal);
		}

		checkConfigParameter(configuration.getString(
			TaskManagerOptions.MANAGED_MEMORY_SIZE).equals(TaskManagerOptions.MANAGED_MEMORY_SIZE.defaultValue()) || managedMemorySize > 0,
			managedMemorySize, TaskManagerOptions.MANAGED_MEMORY_SIZE.key(),
			"MemoryManager needs at least one MB of memory. " +
				"If you leave this config parameter empty, the system automatically pick a fraction of the available memory.");

		return managedMemorySize;
	}
997279
private static long getSizeOfPhysicalMemoryForWindows() {
		BufferedReader bi = null;
		try {
			Process proc = Runtime.getRuntime().exec("wmic memorychip get capacity");

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

			String line = bi.readLine();
			if (line == null) {
				return -1L;
			}

			if (!line.startsWith("Capacity")) {
				return -1L;
			}

			long sizeOfPhyiscalMemory = 0L;
			while ((line = bi.readLine()) != null) {
				if (line.isEmpty()) {
					continue;
				}

				line = line.replaceAll(" ", "");
				sizeOfPhyiscalMemory += Long.parseLong(line);
			}
			return sizeOfPhyiscalMemory;
		}
		catch (Throwable t) {
			LOG.error("Cannot determine the size of the physical memory for Windows host " +
					"(using 'wmic memorychip')", t);
			return -1L;
		}
		finally {
			if (bi != null) {
				try {
					bi.close();
				} catch (Throwable ignored) {}
			}
		}
	}
1075907
public static int getPageCount(int size, int pageSize, int page) {
        int totalPage = size / pageSize;
        if (size > pageSize * totalPage) {
            totalPage += 1;
        }
        return totalPage;
    }
581800
protected int getSize()
   {
      if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getSize");
      int headerSize = 0;
      if (layout == JFapChannelConstants.XMIT_PRIMARY_ONLY)
         headerSize = JFapChannelConstants.SIZEOF_PRIMARY_HEADER;
      else if (layout == JFapChannelConstants.XMIT_CONVERSATION)
         headerSize = JFapChannelConstants.SIZEOF_PRIMARY_HEADER + JFapChannelConstants.SIZEOF_CONVERSATION_HEADER;
      else if (layout == JFapChannelConstants.XMIT_SEGMENT_START)
         headerSize = JFapChannelConstants.SIZEOF_PRIMARY_HEADER + JFapChannelConstants.SIZEOF_CONVERSATION_HEADER + JFapChannelConstants.SIZEOF_SEGMENT_START_HEADER;
      else if (layout == JFapChannelConstants.XMIT_SEGMENT_MIDDLE)
         headerSize = JFapChannelConstants.SIZEOF_PRIMARY_HEADER + JFapChannelConstants.SIZEOF_CONVERSATION_HEADER;
      else if (layout == JFapChannelConstants.XMIT_SEGMENT_END)
         headerSize = JFapChannelConstants.SIZEOF_PRIMARY_HEADER + JFapChannelConstants.SIZEOF_CONVERSATION_HEADER;
      else
      {
         throw new SIErrorException(TraceNLS.getFormattedMessage(JFapChannelConstants.MSG_BUNDLE, "TRANSDATA_INTERNAL_SICJ0060", null, "TRANSDATA_INTERNAL_SICJ0060")); // D226223 
      }
      int retValue = primaryHeaderFields.segmentLength - headerSize;
      if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getSize", ""+retValue);
      return retValue;
   }
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);
        }
    }
1302938
@Override
    public int size() {
        stateLock.readLock().lock();
        try {
            switch (state) {
                default:
                    // This list might be empty or full or somewhere in between:
                    // we don't know until we look!
                    preFetchAll();
                    // The list is now either complete or timed out - recurse to find the result.
                    return size();
                case TIMED_OUT:
                    return currentSize();
                case COMPLETE_WITH_FAILURES:
                    return elements.length - failedKeys.size();
                case COMPLETE:
                    return elements.length;
            }
        } finally {
            stateLock.readLock().unlock();
        }
    }
1215517
public long length() throws IOException {
        try {
            return Libcore.os.fstat(fd).st_size;
        } catch (ErrnoException errnoException) {
            throw errnoException.rethrowAsIOException();
        }
    }
554987
public long byteSize()
	{

		long byteSize = 3;

		int size = parts.size();

		for (int i = 0; i < size; i++) {
			byteSize += this.parts.get(i).byteSize();
		}

		return byteSize;
	}