Memory

Usage

use Memory;

or

import Memory;

Submodules

The Memory module provides submodules that contain operations related to memory usage and memory initialization.

Warning

In previous releases, the Memory module contained procedures which reported information about memory usage. These procedures are now deprecated - please use the equivalents in the Diagnostics submodule instead.

enum MemUnits { Bytes, KB, MB, GB }

Warning

This enum is deprecated - please use Diagnostics.MemUnits.

The amount of memory returned by locale.physicalMemory can be expressed either as individual bytes or as chunks of 2**10, 2**20, or 2**30 bytes.

proc locale.physicalMemory(unit: MemUnits = MemUnits.Bytes, type retType = int(64))

Warning

This method is deprecated - please use Diagnostics.locale.physicalMemory().

How much physical memory is present on this locale?

This quantity does not take into account things like virtual memory support which might allow for allocating a larger amount, or system or user limits which might prevent allocating so much.

Note

Unlike the other procedures in the Memory module, this one does not require memory tracking to be enabled.

Arguments
  • unit : MemUnits – Units in which the returned value is to be expressed.

  • retType : type – Type of the returned value. Defaults to int(64).

Returns

Size of physical memory on the locale where the call is made.

Return type

retType

proc memoryUsed()

Warning

This function is deprecated - please use Diagnostics.memoryUsed().

How much memory is this program currently using on this locale?

This is the amount of memory known to be currently allocated on the calling top-level (network-connected) locale by the program, through Chapel mechanisms. It does not include memory allocated directly from the system, outside of Chapel mechanisms, such as allocations made by code written in other languages and linked into the program.

Returns

Amount of allocated memory, in bytes.

Return type

uint(64)

proc printMemAllocs(thresh = 0)

Warning

This function is deprecated - please use Diagnostics.printMemAllocs().

Print detailed information about allocated memory to memLog. The report contains a section for each top-level locale, containing a table of entries for the allocations made on that locale. Each entry shows the source file and line at which the allocation was requested, the address and size (bytes) of the allocated space, and a description of the type of information the requesting code said it was going to store there.

Arguments

thresh : int – Do not print entries whose size is less than this. Defaults to 0.

proc printMemAllocsByType()

Warning

This function is deprecated - please use Diagnostics.printMemAllocsByType().

Print summary information about allocated memory to memLog. The report contains a section for each top-level locale, containing a table of entries, one for each different allocation type for which at least one allocation exists on that locale. The entries show the type (that is, the string the code requesting the allocation used to describe what it would store there) and the total number of allocations and bytes allocated for that type.

proc printMemAllocStats()

Warning

This function is deprecated - please use Diagnostics.printMemAllocStats().

Print summary memory statistics to memLog. The report contains a section for each top-level locale showing the number of bytes of memory currently allocated, the maximum number allocated at any point during execution (the high-water mark), and the sum of the sizes of all allocation and deallocation requests.

proc startVerboseMem()

Warning

This function is deprecated - please use Diagnostics.startVerboseMem().

Start on-the-fly reporting of memory allocations and deallocations done on any locale. Continue reporting until stopVerboseMem is called.

The reporting output consists of a single line describing each memory allocation or deallocation, written to memLog.

proc stopVerboseMem()

Warning

This function is deprecated - please use Diagnostics.stopVerboseMem().

Stop on-the-fly reporting of memory allocations and deallocations done on any locale.

proc startVerboseMemHere()

Warning

This function is deprecated - please use Diagnostics.startVerboseMemHere().

Start on-the-fly reporting of memory allocations and deallocations done on this locale. Continue reporting until stopVerboseMemHere is called.

The reporting output consists of a single line describing each memory allocation or deallocation, written to memLog.

proc stopVerboseMemHere()

Warning

This function is deprecated - please use Diagnostics.stopVerboseMemHere().

Stop on-the-fly reporting of memory allocations and deallocations done on this locale.