pymel.core.system.memory

memory(*args, **kwargs)

Used to query essential statistics on memory availability and usage. By default memory sizes are returned in bytes. Since Maya’s command engine only supports 32-bit signed integers, any returned value which cannot fit into 31 bits will be truncated to 2,147,483,647 and a warning message displayed. To avoid having memory sizes truncated use one of the memory size flags to return the value in larger units (e.g. megabytes) or use the asFloat flag to return the value as a float.

Flags:

Long Name / Short Name Argument Types Properties
asFloat / af bool ../../../_images/create.gif
  Causes numeric values to be returned as floats rather than ints. This can be useful if you wish to retain some of the significant digits lost when using the unit size flags.
debug / dbg bool  
   
freeMemory / fr bool ../../../_images/create.gif
  Returns size of free memory
gigaByte / gb bool ../../../_images/create.gif
  Return memory sizes in gigabytes (1024*1024*1024 bytes)
heapMemory / he bool ../../../_images/create.gif
  Returns size of memory heap
kiloByte / kb bool ../../../_images/create.gif
  Return memory sizes in kilobytes (1024 bytes)
megaByte / mb bool ../../../_images/create.gif
  Return memory sizes in megabytes (1024*1024 bytes)
pageFaults / pf bool ../../../_images/create.gif
  Returns number of page faults
pageReclaims / pr bool ../../../_images/create.gif
  Returns number of page reclaims
physicalMemory / phy bool ../../../_images/create.gif
  Returns size of physical memory
summary / sum bool ../../../_images/create.gif
  Returns a summary of memory usage. The size flags are ignored and all memory sizes are given in megabytes.
swapFree / swf bool ../../../_images/create.gif
  Returns size of free swap
swapLogical / swl bool ../../../_images/create.gif
  Returns size of logical swap
swapMax / swm bool ../../../_images/create.gif
  Returns maximum swap size
swapPhysical / swp bool ../../../_images/create.gif
  Returns size of physical swap
swapReserved / swr bool  
   
swapVirtual / swv bool ../../../_images/create.gif
  Returns size of virtual swap
swaps / sw bool ../../../_images/create.gif
  Returns number of swaps Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.memory

Example:

import pymel.core as pm

pm.memory(freeMemory=True)
# Result: 0 #

pm.memory(freeMemory=True megaByte=True)
521

pm.memory(freeMemory=True megaByte=True asFloat=True)
521.33203125