On 5 April 2021 at 18:27, xiaoyan yu wrote: | Thank you all for your help. | We embedded R in our program and found the memory in the process | accumulated while our expectation is that the memory will go down after | each R evaluation. | I started to write a test program with only a few lines of R embedded codes | and found the memory never went down even after R library is unloaded. | Please find more details in the readme and test program at | https://github.com/xiaoyanyuvt/RMemTest
You may find the projects RInside (for easily embedding R inside C++ programs) and littler (also embedding R, but using C only, for use in lightweight cmdline applications) useful. Those have existed for, give or take, 10 and 15 years and have not proven to show memory leaks so I feel the burden of proof is still on you. Also I got your program to compile (after making the 'makefile' a bit more general, and fixing two things upsetting current C++ compilers) but I am not sure we really see memory consumption: edd@rob:~$ ps -fv $(pgrep -x foo) PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND 1456192 pts/9 S+ 0:00 0 1 5890 1768 0.0 ./foo edd@rob:~$ ps -fv $(pgrep -x foo) PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND 1456192 pts/9 Sl+ 0:00 0 1 1617174 9896 0.0 ./foo edd@rob:~$ Dirk -- https://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel