tgc: A function for memory management.

Description Usage Arguments Value Examples

Description

A call to tgc() forces a garbage collection if memory usage is above a certain threshold, by default when approximately half of the available mememory is in use by R. Calling tgc(0) performs a standard garbage collection and is therefore the same as gc() with the additional option to delete the output of gc() from memory, such that the call is entirely silent. The function makes a request to the OS (windows only support) to retun memory usage statistics, if this call fails garbage collection will be forced even if memory usage is below the supplied threshold.

Usage

1
tgc(maxmemshare = 0.5, verbose = FALSE, emptythrash = TRUE)

Arguments

maxmemshare

Numeric between 0 and 1 indicating the threshold share of memory usage that triggers garbage collection.

verbose

Should diagnostics be printed? FALSE by default.

emptythrash

Should the object that containsthe output from the garbage collection, including messages, be deleted from memory? TRUE by default. If TRUE, tgc() is silent.

Value

Prints diagnostics of the garbage collection, or silent when emptytrash is TRUE.

Examples

1
2
3
4
5
tgc()

tgc(maxmemshare=0, verbose = FALSE, emptytrash = TRUE)

tgc(0, TRUE, FALSE)

BPJandree/AutoGLM documentation built on May 5, 2019, 10:25 a.m.