Class MemoryTracker


  • public final class MemoryTracker
    extends java.lang.Object
    The MemoryTracker class tracks usage of memory regions.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  MemoryTracker.Region  
    • Constructor Summary

      Constructors 
      Constructor Description
      MemoryTracker()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isUsed​(java.math.BigInteger address)
      Checks whether the specified address is location in one of regions in use.
      void reset()  
      java.lang.String toString()  
      MemoryTracker.Region use​(java.math.BigInteger startAddress, java.math.BigInteger endAddress)
      Tries to reserve a memory region within the specified address range.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • MemoryTracker

        public MemoryTracker()
    • Method Detail

      • use

        public MemoryTracker.Region use​(java.math.BigInteger startAddress,
                                        java.math.BigInteger endAddress)
        Tries to reserve a memory region within the specified address range. If these addresses are already in use, reservation does not occur and the overlapped region is returned.
        Parameters:
        startAddress - Start address of the region.
        endAddress - End address of a region (excluded).
        Returns:
        null if region is reserved successfully or a overlapping region is the specified address range is already in use.
      • isUsed

        public boolean isUsed​(java.math.BigInteger address)
        Checks whether the specified address is location in one of regions in use.
        Parameters:
        address - Address to be checked.
        Returns:
        true if the address is within one of the used regions of false othwerwise.
      • reset

        public void reset()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object