[Q] Can I somehow facilitate memory management / garbage collection in tight loops?
Hi,
I'm running into memory problems and am looking for some advice.
I run a double tight for-loop in which I draw thousands of shapes. While the for-loops are active I notice that memory is being consumed quickly. When I stop the drawing process and with the resulting Illustrator file still open, I see memory usage fall significantly, back to normal levels. This makes me suspect that it is not the resulting drawing that is consuming memory but the variables I use in the loops. It feels as if garbage collection isn't working properly: as if variables that go out of scopes are not released for cleanup.
I there anything I can/should do about this? I already do a 'save as' action at the end of each inner loop. Should I bring all variables outside of the loops? Should I nullify them?
Any help greatly appreciated.
// Tom
for (var i = 0; i < kNumRows; i++) {
for (var j = 0; j < kNumCols; j++) {
// I use a lot of local variables here
}
// saveas action
}
