MemoryManager Module



Contents


Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: TagIntType = kind(0)
integer, private, parameter :: MaxLen = 500000
integer, private, parameter :: MaxWarn = 10
integer, private, parameter :: nLargeObjects = 10
logical, public, save :: CachingMemLog = .true.
logical, private, save :: MemUnitsBytes = .true.
logical, private, save :: err_output = .true.
integer(kind=int64), public, save :: MaxMemory
integer(kind=int64), public, save :: MemoryUsed
integer(kind=int64), public, save :: MemoryLeft
integer(kind=int64), private, save :: MaxMemoryUsed
logical, private, save :: initialised = .false.
logical, private, save :: warned = .false.
integer, private, save :: nWarn = 0
logical, private, save :: debug = .false.
type(MemLogEl), private, allocatable, save :: MemLog(:)
integer, private, save :: ipos = 1
type(MemLogEl), private, allocatable, save :: PeakMemLog(:)
type(MemLogEl), private, save :: LargeObjLog(nLargeObjects)
integer, private, save :: ismall = 1
integer(kind=int64), public, allocatable, save :: LookupPointer(:)

Interfaces

public interface LogMemAlloc

  • private subroutine LogMemAlloc_int32(ObjectName, ObjectSize, ElementSize, AllocRoutine, tag, err, nCalls)

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: ObjectName
    integer(kind=int32), intent(in) :: ObjectSize
    integer(kind=int32), intent(in) :: ElementSize
    character(len=*), intent(in) :: AllocRoutine
    integer(kind=TagIntType), intent(out) :: tag
    integer, intent(in), optional :: err
    integer, intent(inout), optional :: nCalls
  • private subroutine LogMemAlloc_int64(ObjectName, ObjectSize, ElementSize, AllocRoutine, tag, err, nCalls)

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: ObjectName
    integer(kind=int64), intent(in) :: ObjectSize
    integer(kind=int64), intent(in) :: ElementSize
    character(len=*), intent(in) :: AllocRoutine
    integer(kind=TagIntType), intent(out) :: tag
    integer, intent(in), optional :: err
    integer, intent(inout), optional :: nCalls

Derived Types

type, private ::  MemLogEl

Components

Type Visibility Attributes Name Initial
character(len=25), public :: ObjectName = ''
character(len=25), public :: AllocRoutine = ''
character(len=25), public :: DeallocRoutine = 'not deallocated'
integer(kind=int64), public :: ObjectSize = 0

Subroutines

public subroutine InitMemoryManager(MemSize, print_err)

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in), optional :: MemSize
logical, intent(in), optional :: print_err

private subroutine LogMemAlloc_int32(ObjectName, ObjectSize, ElementSize, AllocRoutine, tag, err, nCalls)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: ObjectName
integer(kind=int32), intent(in) :: ObjectSize
integer(kind=int32), intent(in) :: ElementSize
character(len=*), intent(in) :: AllocRoutine
integer(kind=TagIntType), intent(out) :: tag
integer, intent(in), optional :: err
integer, intent(inout), optional :: nCalls

private subroutine LogMemAlloc_int64(ObjectName, ObjectSize, ElementSize, AllocRoutine, tag, err, nCalls)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: ObjectName
integer(kind=int64), intent(in) :: ObjectSize
integer(kind=int64), intent(in) :: ElementSize
character(len=*), intent(in) :: AllocRoutine
integer(kind=TagIntType), intent(out) :: tag
integer, intent(in), optional :: err
integer, intent(inout), optional :: nCalls

public subroutine LogMemDealloc(DeallocRoutine, tag, err)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: DeallocRoutine
integer(kind=TagIntType), intent(inout) :: tag
integer, intent(in), optional :: err

public subroutine LeaveMemoryManager()

Arguments

None

public subroutine PrintMemory(PrintDeallocated, iunit)

Arguments

Type IntentOptional Attributes Name
logical, intent(in), optional :: PrintDeallocated
integer, intent(in), optional :: iunit

private subroutine WriteMemLogHeader(iunit)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: iunit

private subroutine WriteMemSize(iunit, MemSize)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: iunit
integer(kind=int64), intent(in) :: MemSize