Closes the environment and releases its native resources. Closing is
idempotent: calling it on an already-closed environment does nothing, so it
is safe to pair an explicit close with an on.exit() guard.
Arguments
- env
An
mdbx_envobject, frommdbx_env_open().
Details
Closing is refused while any transaction on the environment is still open,
because 'libmdbx' documents that using a transaction after its environment
closes is undefined behaviour. Commit or abort them first — or use
mdbx_with_read() / mdbx_with_write(), which cannot leave one open.
Using a closed environment for anything else is an error rather than a crash.
Examples
path <- tempfile(fileext = ".mdbx")
env <- mdbx_env_open(path)
mdbx_env_close(env)
mdbx_env_is_open(env)
#> [1] FALSE
unlink(c(path, paste0(path, "-lck")))