Finding the amount of memory allocated for the environment output by cmdstanr sampling

Viewed 108

Assigning the output of a call to the sample() method of a compiled model from the cmdstanr package produces an "environment" in my global environment rather than a model object. Is there some way to see how much memory this environment is using?

For example:

library(cmdstanr)

# Compile an arbitrary model (model needed)
mod <- cmdstan_model(stan_file = "foo.stan")

# Fit model (data needed)
fit <- mod$sample(
  data = bar)

In this case, fit is an environment in my RStudio global environment. Typical objects will show their size in the RStudio environment explorer, but this does not. I'd like to see how much RAM it's occupying.

0 Answers
Related