Go to: Synopsis. Return value. Flags. Python examples.

Synopsis

memory([asFloat=boolean], [freeMemory=boolean], [gigaByte=boolean], [heapMemory=boolean], [kiloByte=boolean], [megaByte=boolean], [pageFaults=boolean], [pageReclaims=boolean], [physicalMemory=boolean], [summary=boolean], [swapFree=boolean], [swapLogical=boolean], [swapMax=boolean], [swapPhysical=boolean], [swapVirtual=boolean], [swaps=boolean])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

memory is undoable, NOT queryable, and NOT editable.

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.

Return value

None

Flags

asFloat, freeMemory, gigaByte, heapMemory, kiloByte, megaByte, pageFaults, pageReclaims, physicalMemory, summary, swapFree, swapLogical, swapMax, swapPhysical, swapVirtual, swaps
Long name (short name) Argument types Properties
kiloByte(kb) boolean create
Return memory sizes in kilobytes (1024 bytes)
megaByte(mb) boolean create
Return memory sizes in megabytes (1024*1024 bytes)
gigaByte(gb) boolean create
Return memory sizes in gigabytes (1024*1024*1024 bytes)
asFloat(af) boolean create
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.
heapMemory(he) boolean create
Returns size of memory heap
freeMemory(fr) boolean create
Returns size of free memory
physicalMemory(phy) boolean create
Returns size of physical memory
pageFaults(pf) boolean create
Returns number of page faults
pageReclaims(pr) boolean create
Returns number of page reclaims
summary(sum) boolean create
Returns a summary of memory usage. The size flags are ignored and all memory sizes are given in megabytes.
swaps(sw) boolean create
Returns number of swaps
swapFree(swf) boolean create
Returns size of free swap
swapMax(swm) boolean create
Returns maximum swap size
swapVirtual(swv) boolean create
Returns size of virtual swap
swapPhysical(swp) boolean create
Returns size of physical swap
swapLogical(swl) boolean create
Returns size of logical swap

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

cmds.memory(freeMemory=True)
# Result: 525451264 #

cmds.memory(freeMemory=True megaByte=True)
# Result: 521 #

cmds.memory(freeMemory=True megaByte=True asFloat=True)
# Result: 521.33203125 #