I am using OpenMaple (kv->rtableCreate or RTableCreate) to allocate large rtables which I then fill with data before returning to Maple. It seems to be slow. For example, a table with 120 Mwords takes 1 second to allocate and 0.640 seconds to fill. I suspect this is because the table is initialized to zero.
I would like to skip this initialization and maybe use malloc to allocate the table, however I want it to behave like a normal Maple object (ie: garbage collected if not referenced, etc). The documentation says it is important to set rts->foreign to true, but it doesn't say why. Will this prevent garbage collection ? I would also like to know the purpose of rts->foreign.
update: After thinking about it a bit more, there's really no way to do what I want. If Maple is to free the memory then I need Maple to allocate it, and there seems to be no option to stop Maple from initializing the data, unfortunately.