I am experiencing what I think is a memory problem. I am manipulating
large lists (1000-3000 elements, with each element being a list containing
10-12 elements) with some "home-made" functions, and the computer is taking
a long time to complete the calculations. By introducing a counter into
the function, which displays itself after every [what I would deam]
"major" calculation, I can see that the computer is not actually working
on the calculation but is clearing up its memory, or something. I can
recodnize this because the same type of calculation takes only a few
seconds one moment and then suddenly 4 minutes the next. Also, during these
times where the counter doesn't change as fast as before (i.e. computer is
going slow) the hard drive can be heard "grinding" away, whereas it isn't
barely heard at all when the counter is decreasing at a constant rate.
Actually, judging by the speed of the counter when going at a constant rate
(regular computer speed), about 80% of the time taken to complete an entire
function applied to these lists is taken up with this "memory clearing".
So here are my questions: what things should I avoid in programming my own
functions so as to avoid these memory clearing problems? Also, what is the
best way to make use of the Unbind function: within the main body of the
function? at the end, just before "return()"? Some of the built-in functions
that I am using might be troublesome too, I think. Here are my suspects:
Sublist, Unbind (used quite often, as soon as a local variable which has alot
of information attached to it is no longer needed), Filtered, Copy (used quite
often - maybe too often and when not necessary, but there for safety reason,
so as not to alter certain variables), and SortParallel. Also, I use "for"
loops ALOT, but they are necessary as I'm not the best with recursion.
The main reason I am concerned is that at present, some calculations are
taking 2 hours to do, and it will be necessary to move to even bigger
computations which will take much more time, exponentially in fact!
I am using a 66 MHz IBM-486 DX2, with 16 Megabytes of RAM. In the gap.bat
file found in the \bin directory, I have set the memory to 15.3 m. Otherwise,
no changes have been made to gap.bat.
Thank you for any help you can give!!