Class BasicMemoryManager

    • Constructor Detail

      • BasicMemoryManager

        public BasicMemoryManager()
    • Method Detail

      • allocate

        public org.bytedeco.javacpp.Pointer allocate​(long bytes,
                                                     MemoryKind kind,
                                                     boolean initialize)
        This method returns PLEASE NOTE: Cache options depend on specific implementations
        Specified by:
        allocate in interface MemoryManager
        Parameters:
        bytes -
        kind -
        initialize -
      • collect

        public void collect​(INDArray... arrays)
        This method detaches off-heap memory from passed INDArray instances, and optionally stores them in cache for future reuse PLEASE NOTE: Cache options depend on specific implementations
        Specified by:
        collect in interface MemoryManager
        Parameters:
        arrays -
      • toggleAveraging

        public void toggleAveraging​(boolean enabled)
        Description copied from interface: MemoryManager
        This method enables/disables calculation of average time spent within loops Default: false
        Specified by:
        toggleAveraging in interface MemoryManager
      • purgeCaches

        public void purgeCaches()
        This method purges all cached memory chunks
        Specified by:
        purgeCaches in interface MemoryManager
      • memcpy

        public void memcpy​(DataBuffer dstBuffer,
                           DataBuffer srcBuffer)
        Description copied from interface: MemoryManager
        This method does memcpy from source buffer to destination buffer PLEASE NOTE: This method is NOT safe.
        Specified by:
        memcpy in interface MemoryManager
      • notifyScopeEntered

        public void notifyScopeEntered()
        Description copied from interface: MemoryManager
        PLEASE NOTE: This method is under development yet. Do not use it.
        Specified by:
        notifyScopeEntered in interface MemoryManager
      • notifyScopeLeft

        public void notifyScopeLeft()
        Description copied from interface: MemoryManager
        PLEASE NOTE: This method is under development yet. Do not use it.
        Specified by:
        notifyScopeLeft in interface MemoryManager
      • invokeGcOccasionally

        public void invokeGcOccasionally()
        Description copied from interface: MemoryManager
        This method calls for GC, and if frequency is met - System.gc() will be called
        Specified by:
        invokeGcOccasionally in interface MemoryManager
      • isPeriodicGcActive

        public boolean isPeriodicGcActive()
        Description copied from interface: MemoryManager
        This method returns true, if periodic GC is active. False otherwise.
        Specified by:
        isPeriodicGcActive in interface MemoryManager
        Returns:
      • setOccasionalGcFrequency

        public void setOccasionalGcFrequency​(int frequency)
        Description copied from interface: MemoryManager
        Sets manual GC invocation frequency. If you set it to 5, only 1/5 of calls will result in GC invocation If 0 is used as frequency, it'll disable all manual invocation hooks. default value: 5
        Specified by:
        setOccasionalGcFrequency in interface MemoryManager
      • setAutoGcWindow

        public void setAutoGcWindow​(int windowMillis)
        Description copied from interface: MemoryManager
        This method enables/disables periodic System.gc() calls. Set to 0 to disable this option.
        Specified by:
        setAutoGcWindow in interface MemoryManager
        Parameters:
        windowMillis - minimal time milliseconds between calls.
      • getLastGcTime

        public long getLastGcTime()
        Description copied from interface: MemoryManager
        This method returns time (in milliseconds) of the las System.gc() call
        Specified by:
        getLastGcTime in interface MemoryManager
        Returns:
      • togglePeriodicGc

        public void togglePeriodicGc​(boolean enabled)
        Description copied from interface: MemoryManager
        This method enables/disables periodic GC
        Specified by:
        togglePeriodicGc in interface MemoryManager
      • getAverageLoopTime

        public int getAverageLoopTime()
        Description copied from interface: MemoryManager
        This method returns average time between invokeGCOccasionally() calls
        Specified by:
        getAverageLoopTime in interface MemoryManager
        Returns:
      • releaseCurrentContext

        public void releaseCurrentContext()
        Description copied from interface: MemoryManager
        This method releases Context (if current backend has one, sure)
        Specified by:
        releaseCurrentContext in interface MemoryManager