Skip to content
Prev 36601 / 63424 Next

Memory allocation in C/C++ vs R?

On Fri, 30 Apr 2010, Dominick Samperi wrote:

            
Standard in C++, not C, that is.
Then you have been fortunate, maybe because you work on a very limited 
range of compilers and OSes?  I have been plagued by this on modern 
Windows toolchains where it seems that dynamically linked C++ code 
only works if called from a C++ main program (and R is a C main 
program).
R does not use C++.  So the 'C++ side' is entirely in the packages 
which choose to use it, and they manage their own memory usage via 
the C++ runtime they are linked to.  Basically R mallocs all the 
memory it uses, and the hope is that the C++ runtime does not
interfere with malloc (and of course it is in practice also obtaining 
memory by malloc or its equivalent).
[Please do note that what the posting guide asked you NOT to do.]