sfepy.base.mem_usage module

Memory usage functions.

sfepy.base.mem_usage.get_mem_usage(obj, usage=None, name=None, traversal_order=None, level=0)[source]

Get lower bound of memory usage of an object.

Takes into account strings, numpy arrays and scipy CSR sparse matrices, descends into sequences, mappings and objects.

obj : any object

The object to be measured.

usage : dict

The dict with memory usage records, serving also as a cache of already traversed objects.

name : str

The name to be given to the object in its record.

traversal_order : list, internal

The traversal order of the object.

level : int, internal

The recurrence level.

usage : int

The object’s lower bound of memory usage.

sfepy.base.mem_usage.print_mem_usage(usage, order_by=’usage’, direction=’up’, print_key=False)[source]

Print memory usage dictionary.

usage : dict

The dict with memory usage records.

order_by : ‘usage’, ‘name’, ‘kind’, ‘nrefs’, ‘traversal_order’, or ‘level’

The sorting field name.

direction : ‘up’ or ‘down’

The sorting direction.

print_key : bool

If True, print also the record key (object’s id).