Illustrator 10 - script slowdown, Real Memory bloat

Symptoms:
Executing any of a couple dozen graph building scripts I’ve written via osascript command… the charts build very fast FOR ABOUT THE FIRST 6-8 CHARTS. After that it slows down dramatically - probably going only 25% its original speed for the rest of the charts. Stopping the script and restarting Illustrator brings back the speed for the first 6-8 charts again. Running script again without restarting Illustrator - script starts off slow.

The interesting symptom is found when watching the Utilities/Activity Monitor. During first 6-8 charts built Illustrator’s “Real Memory” hovers around 85 MB. On all subsequent charts it increases by about 5-10 MB per chart. My current Illustrator “Real Memory” is 438 MB - if I ran the script a lot more it would just keep going past 1 GB.

My guess is that the slowdown is related to the need to write 5-10 MB of data to the hard drive during the execution of the chart. Why is this happening? Why only after the first 6-8 charts?

Any ideas?

Thanks,
Dave

InDesign has similar problems due the Undo function. For InDesign you can save the document and that clears the undo history - you might try that will your Illustrator code? iolaire