Skip to content

Calloc() & Free() in different .C(.) calls --> not usable ?

1 message · Brian Ripley

#
My nnet code does that, as does the rpart code.  I have not seen any
problems with memory-build up with either in R, and have run both
repetitively, e.g. within two-level cross-validations running for
days.  Calloc and Free are just error-checking wrappers for calloc and
free, so what happens is down to those on your OS.
It frees the memory to malloc. There is no guarantee that malloc
returns it to the OS, but malloc should do so or re-use it.  I've just
monitored Solaris running R 1.1.1, and there is no evidence from ps/top that
ever returns any memory to the OS during these runs.  But it does not
build up more than 2Mb or so above R's usage at its first GC call, even
though it is being asked to allocate a few hundred Kb and deallocate it
many times.