releaseVariables: Release variables from a shared memory namespace

View source: R/releaseVariables.R

releaseVariablesR Documentation

Release variables from a shared memory namespace

Description

Delete variables from the shared memory space. Actual release occurs only when no active views remain.

Usage

releaseVariables(namespace, variableNames)

Arguments

namespace

Character(1) used at registration time.

variableNames

Character vector of names to free.

Details

Registered buffers remain allocated until all views are released. If any worker still holds a view, releaseVariables cannot reclaim memory.

Thread safety

Registered buffers may be read concurrently by many processes. Concurrent writes must be synchronized externally (e.g., interprocess mutex). Do not call the R API from secondary threads.

Wrappers such as memApply / memLapply call this function on.exit.

Value

Invisibly, TRUE on success.

Note

This call succeeds in removing ownership, but underlying memory is only unmapped when every process has called releaseViews for those variables. Use viewList and pageList for diagnostics.

See Also

registerVariables, releaseViews

Examples

ns <- "example"
X <- matrix(rnorm(100), 10, 10)
registerVariables(ns, list(X = X))
# later ...
releaseVariables(ns, "X")

memshare documentation built on Dec. 5, 2025, 9:07 a.m.