[JS] $.gc() - garbage collection, etc.
W_J_T Nov 19, 2012 11:04 AMHello everyone, bear with me for all the questions.
$.gc() - Initiates garbage collection in the JavaScript engine.
Ok, maybe I have a fundamental misunderstanding of things here, but I am wanting to understand a few things:
- I was wanting to know if $.gc() can be called and executed outside of running scripts directly from with in the ESTK toolkit? The reason I ask is that its listed in the tools guide but not the javascript reference. I know things like $.writeln() only seem to apply/display from with in the ETSK toolkit, is it still executed otherwise silently when it appears in a script, $.sleep() works fine when used. So what about $.gc(), can I call it and have it execute from within my scripts outside of running them via the ETSK toolkit?
- Is there a way to test if its in fact being called, executed, working? I have seen people talking about calling it twice and doubling up, $.gc() $.gc(), thus does it even work, or is it just a fabled mythical thing.
- Do codes when executed outside the ETSK toolkit get funneled through the same javascript runtime engine that they do when executing from with in the ETSK toolkit? Is it all the same and the ETSK toolkit is just Adobe's GUI for writing, debugging, targeting different api's for the various programs with in the same underlying engine?
- Does ScriptBay tap into and use this same underlying framework? Does it do anything inherently on its own for garbage collection? (since it can run scripts sequentially, repetitively, etc..)
- Does anyone know what embedded javascript runtime/engine Adobe is using? This would be beneficial for any specific optimizations that can be considered or kept in mind in general based on the specific JS engine thats implemented when coding.
- So aside from the mythical $.gc() , what other best practices for garbage collection should be considered? I know people suggest wrapping your codes in a function, talk of #targetengine (saw in InDesign forum), etc… are there any other common do's and dont's, best practices pertaining specifically to illustrator? Granted I can find a lot about Javascript in general across the web but what about how it applies to Illustrator, its api, limitations, performance, garbage collection, etc..
- Thanks. ;-)
Again, sorry for all the questions, I am still trying to continue to wrap my head around different aspects of this whole thing. Thanks everyone for any feedback your able to offer and provide. Many thanks in advance, its greatly appreciated. Thanks again.


