| memshare_gc | R Documentation |
Given a namespace identifier (identifies the shared memory space to register to), this function removes all handles to shared memory held by the master and a worker context.
memshare_gc(namespace, cluster)
namespace |
string of the identifier of the shared memory context. |
cluster |
A worker context (parallel cluster) that holds views or pages in the same memory context as the master. NULL by default; then only the master session gets its handles removed. |
No return value, called deallocation of memory pages and views in a joint memory context.
Julian Maerte
releaseVariables, releaseViews
cluster = parallel::makeCluster(1)
mat = matrix(0,5,5)
registerVariables("ns", list(mat=mat))
parallel::clusterEvalQ(cluster, {
view = memshare::retrieveViews("ns", c("mat"))
})
## Not run:
# At this point each worker holds a view of mat
## End(Not run)
memshare_gc("ns", cluster)
## Not run:
# Every workers viewership handle gets destroyed, master sessions page handle
# gets destroyed.
# As no handles are left open, the memory is free'd.
## End(Not run)
parallel::stopCluster(cluster)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.