I have a software that embeds cling the following way:
create on the heap an instance of an interpreter
load some files and libraries at initialisation time
call an interpreted function using a single execute() call to draw OpenGL code at every frame
I get a lot of allocations every frame (growing up at a rate of 20Mb/sec)
If I execute the same OpenGL code without interpreting (compiling the code within the software and calling it directly instead of using cling) I do not get the same amount of memory allocations.
Shouldn’t happen. Can you send me a massif output? valgrind --tool=massif … Which version (e.g. commit hash) of cling do you use exactly?
As a workaround you can always ask cling to give you a C-style function pointer, and if your function is really the same throughout, just keep on calling that function pointer. Use DeclareCFunction(), RunFunction() for that.