storage()
Internal storage in S-PLUS is allocated in arenas (currently 4088 bytes)
which are then divided to satisfy memory requests.
Not all of an arena will be used up by current requests.
Each arena is associated with one of the frames (function calls) currently
being evaluated.
Storage requests that would occupy more than half of a standard arena
are given a separate individual arena.
Each data vector consists of a 32 byte "header" and storage for the data.
The headers for a given frame are allocated in "buckets" consisting of
500 (on DOS 75) headers and 20 bytes of housekeeping information for
a total size of 16020 bytes (on DOS 2420) per bucket. (These sizes
may not be quite right on some machines: they depend on how the C
compiler chooses to pad structures and on the size of pointer and
integer types.)
The first four components of the value of
storage
give the allocated and used
size, the actual location in memory, and the associated frame number
for each storage arena.
The next three components give the number of headers ever allocated
(since the creation of the bucket), the number
allocated then freed, and the associated frame number for each
bucket of headers.
# barplot (from a function) of local arenas temp <- storage() barplot(temp$allocated[temp$frame == sys.nframe()]) barplot(rbind(temp$used[1:22], temp$all[1:22]), blocks=F, density=c(20, 0), angle=c(45, 0), names=as.character(temp$frame[1:22]), main="Arena Allocation and Use", xlab="frame")