Learn R Programming

memshare (version 1.1.0)

viewList: Function to obtain a list of the views the current session holds.

Description

When your current session has retrieved views of shared memory via retrieveViews internally the view is tracked until it is released via releaseViews.

This function serves as a tool to check whether all views have been free'd after usage or to see what views are currently available to the session.

Usage

viewList()

Arguments

Value

An 1:p list of characters of the the p retrieved views

Author

Julian Maerte

Details

The string of each element of the output list has the format <namespace name>.<variable name>. Default is lokal environment.

Useful for leak diagnostics: if releaseVariables did not free memory, check that viewList() is empty across all sessions.

See Also

retrieveViews, releaseViews

Examples

Run this code
  if (FALSE) {
  # MASTER SESSION:
  }
  mat = matrix(0,5,5)
  registerVariables("ns_viewL", list(mat=mat))

  if (FALSE) {
  # WORKER SESSION:
  }
  viewList() # an empty list to begin with (no views retrieved)

  matref = retrieveViews("ns_viewL", c("mat"))
  viewList() 
  if (FALSE) # now equals c("ns_viewL.mat")

  releaseViews("ns_viewL", c("mat"))
  viewList() 
  if (FALSE) {
  # an empty list again
  
  # MASTER SESSION:
  }
  releaseVariables("ns_viewL", c("mat"))

Run the code above in your browser using DataLab