Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

[JS] $.gc() - garbage collection, etc.

Mentor ,
Nov 19, 2012 Nov 19, 2012

Hello 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:

  1. 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?

  2. 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.

  3. 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?

  4. 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..)

  5. 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.

  6. 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..

  7. 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.

TOPICS
Scripting
2.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Mentor ,
Nov 26, 2012 Nov 26, 2012

Hi everyone,

I would welcome any type of feedback, insight, understanding, advice on this topic as a whole, or as it relates to my simple list of posted inquiries. I really appreciate any information that can be offered, it would really help me to understand how more seasoned scriptures approach this topic. Simple thoughts/feedback are fine, dissertations are not required, but always welcome. 😉

Thanks so much everybody, I really appreciate it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Nov 26, 2012 Nov 26, 2012

I can't answer or help with all of those… Here are my thoughts… The dollar object properties and functions can be called on by script from AI, BR, ID & PS… They are NOT restricted for use in the ESTK tookit. Yeah $.writeln() would write to the console if the toolkit were open if NOT then it will probably launch it… So remove or comment these out. As you can see from $.sleep() it does what it says when run in the host app. #targetengine is exclusive to ID this app can have multi-instances ( or something like that ). The other apps have 1 engine and thats it. AI's engine is persistent so wrapping your code is good practice I do this for BR & PS too… See…

http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/illustrator/scripting/readm...

As for garbage collection I've never fould the need to use it… I see some like to set variables back to null but again I don't do this…

You would have been better off asking this question in the ID scripting forum… There are several people there who are better qualified to answer some of this…

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Nov 28, 2012 Nov 28, 2012
LATEST

Thanks so much Muppet Mark for your response and feedback. So would it be appropriate and acceptable to repost this in the InDesign forum as you suggested? I am however only at this point scripting in Illustrator, thus I posted it here as its my focus. Again I really appreciate your response and you taking time to do so, thanks Muppet Mark.

I would still also welcome others input if anyone has anything they would like to add from their experiences. Thanks eveyone.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines