Are you running in #targetengine main and did you try adding var in front of your variables, they are missing from what you posted
I just tried adding #targetengine main to the top of my script - no luck unfortunately.
All variables have been declared using the standard "var counter;", "var myString" etc.
my 2 cents:
it's not a scripting problem, but a data one.
for testing sake try changing from importing illustrator to simple TIFFs or JPGs.
rendering and exporting pdf (or .ai's) eats up tons of memory. at least in windows.
if that's the case, you can try to delete the page after it is exported.
You're probably correct. The files do tend to get quite heavy. But I was expecting Indesign to be able to release the memory after exporting a single page. Alas, it doesn't do that. I could also delete the page, but we would like to save the .indd-file as well
But I tried, just for the fun of it, to close the document and open it again after every 10 pages - and et voilá. It worked! It's not beautiful and I'm not gonna win any awards for it, but for now it'll have to do