Extreme memory usage in nested loop

If the function you are calling uses threads, this problem may be related to 1.9’s memory management issues (supposedly to be resolved in 1.10, some say). Cf: