indexDemoClose: Demo functions for creating and removing external pointers

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/zzz.R

Description

Function indexDemoOpen creates an external pointer pointing to an integer vector of length n, indexDemoClose frees the memory linked to the pointer.

Usage

1
2
indexDemoOpen(n = 10)
indexDemoClose(extPtr)

Arguments

extPtr

the external pointer returned by indexDemoOpen

n

the length of the vector stored in C RAM

Details

If the returned pointer is removed finalization happens at the next gc(), if indexDemoClose is used on the pointer then finalization happens immediately, if the pointer is then removed, the finalizer is called again at the next gc() (but doesn't finalize again).

Value

Function indexDemoOpen returns an external pointer, indexDemoClose returns the integer vector previously linked by the pointer.

Author(s)

Jens Oehlschl<e4>gel

References

R Development Core Team (2007). Writing R Extensions.

See Also

indexInit, indexDone, indexAddTree, indexDelTree

Examples

1
2
3
4
5
6
7
8
ptr <- indexDemoOpen()
rm(ptr)
gc()

ptr <- indexDemoOpen()
indexDemoClose(ptr)
rm(ptr)
gc()

rindex documentation built on Sept. 1, 2018, 1:04 a.m.