I have a
Do loop, which saves data directly to a
.txt file. However when I leave it running for long periods of time the RAM starts to run out till finally my laptop crashes. I've read similar posts on here but nothing seems to have worked.
After each run of the
Do loop, I no longer need the data because it has been saved in a
.txt file. This means I don't require Mathematica to use up my RAM remembering it... but I can't get it to stop!
I tried putting
ClearSystemCache inside the
Do loop at the end but this didnt work. I read somewhere that this could be because I need to clear the memory of the individual subkernels.
What is meant by subkernel? I run
ParallelEvaluate and it launches four kernels, one for each CPU. Are these 4 kernels called subkernels? If so what is 'sub' about them?
But the main question is how do i go about clearing the memory of the subkernals?
My set up is
ParallelEvaluate[ Do[ (bulk of formulae) If[ (condition), PutAppend[ ] ] ] ]
I have tried putting
ParallelEvaluate[ Do[ (bulk of formulae) If[ (condition), PutAppend[ ] ] ClearSystemCache ] ]
However this doesnt seem to work.
I've also tried:
$HistoryLength = 0;at the start of the
Doloop (doesn't change anything)
Remove["Global`*"]inside end of
Doloop (gives an error)
If someone could explain how to clear memory of subkernels and/or give any other suggestions that would be great. Thanks