lsize: Report objects and their memory sizes

Description Usage Arguments Value Author(s) See Also Examples

Description

lsize is like ls, except it returns a numeric vector whose names are the object names, and whose elements are the object sizes. The vector is sorted in order of increasing size. lsize avoids loading objects cached using mlazy; instead of their true size, it uses the size of the file that stores each cached object, which is shown as a negative number. The file size is typically smaller than the size of the loaded object, because mlazy saves a compressed version. NB that lsize will scan all objects in the environment, including ones with funny names, whereas ls does so only if its all.names argument is set to TRUE.

Usage

1
lsize( envir=.GlobalEnv)

Arguments

envir

where to look for the objects. Will be coerced to environment, so that e.g. lsize( 2) and lsize( "package:mvbutils") work. envir can be a sys.frame– useful during debugging.

Value

Named numeric vector.

Author(s)

Mark Bravington

See Also

ls, mlazy

Examples

1
2
3
4
5
6
7
# Current workspace
lsize()
# Contrived example to show objects in a function's environment
{function(..., a, b, c) lsize( sys.frame( sys.nframe())) }()
# a, b, c are all missing; this example might break in future R versions
# ...   a   b   c
#  28  28  28  28

mvbutils documentation built on May 2, 2019, 8:32 a.m.

Related to lsize in mvbutils...