Question: Memory management.

I am running a code that loops through some 500 cases, each one considered separate, each working with a matrix of rationals 100x30 to 5000x900 or possibly larger dimensions. The matrices are not preserved and variables are reused. A concerning pattern emerges as more and more memory is slowly added until all ram (32GB) is spent and this makes no sense. Observing kernelopts(heaps); the number of entries increases steadily. Using gc() a few entries will occasionally disappear, but gc() itself takes longer with each loop.

What can I use to manage this condition?
Also why is there an increasing number of "Thread-Local" entries among the heaps?

Please Wait...