Recursively, runs reproducible::objSize() on the simList environment, so it estimates the correct size of functions stored there (e.g., with their enclosing environments) plus, it adds all other "normal" elements of the simList, e.g., objSize(completed(sim)). The output is structured into 2 elements: the sim environment and all its objects, and the other slots in the simList (e.g., events, completed, modules, etc.). The returned object also has an attribute, "total", which shows the total size.

# S3 method for class 'simList'
objSize(x, quick = FALSE, recursive = FALSE, ...)

Arguments

x

An object

quick

Logical. If FALSE, then an attribute, "objSize" will be added to the returned value, with each of the elements' object size returned also.

recursive

Logical. If TRUE, then, in addition to evaluating the whole object, it will also return the recursive sizes of the elements of a list or environment.

...

Additional arguments (currently unused), enables backwards compatible use.

Value

an estimate of the size of the object, in bytes.

Examples

a <- simInit(objects = list(d = 1:10, b = 2:20))
#> Setting:
#>   options(
#>     reproducible.cachePath = '/tmp/Rtmp4BAZIc/myProject/cache'
#>     spades.inputPath = '/tmp/Rtmp4BAZIc/myProject/inputs'
#>     spades.outputPath = '/tmp/Rtmp4BAZIc/myProject/outputs'
#>     spades.modulePath = '/tmp/Rtmp4BAZIc/myProject/modules'
#>     spades.scratchPath = '/tmp/Rtmp4BAZIc/SpaDES/scratch'
#>   )
#> May20 20:31:45 simInit Using setDTthreads(1). To change: 'options(spades.DTthreads = X)'.
#> May20 20:31:45 simInit User-supplied objects passed into sim for spades call:
#> May20 20:31:45 simInit        <char>
#> May20 20:31:45 simInit 1:          b
#> May20 20:31:45 simInit 2:          d
#> Elapsed time for simInit: 0.03147149 secs
objSize(a)
#> 460.98 kB
utils::object.size(a)
#> 17184 bytes