Forum Discussion

Manfred_F's avatar
Manfred_F
Regular Contributor
10 years ago

JScript - custom classes in script extensions

Is it possible? How do You use them? Create objects and hand over to a caller in another script?

Any examples would be appreciated.

 

Regards,

Manfred

 

 

  • Manfred_F's avatar
    Manfred_F
    10 years ago

    Ok, I've got it.

    Using CollectGarbage();  , even memory leakage problems seem to be avoided when storing in global module variables; I failed to achieve this in vbs.

  • Heh.

     

    Is this to avoid the same gremlins I seem to have hit with doing this via VBScript?

     

    Watching with interest. I have my VBScript one working now using old skool numeric loops rather than iterables on the returned object ....

    • Manfred_F's avatar
      Manfred_F
      Regular Contributor

      Ok, I've got it.

      Using CollectGarbage();  , even memory leakage problems seem to be avoided when storing in global module variables; I failed to achieve this in vbs.

      • Colin_McCrae's avatar
        Colin_McCrae
        Community Hero

        Did you hit memory leaks when doing similar with VBScript extensions creating custom classes?

         

        I'm using C# Script for a project at the moment, and I'm aware that the jScript engine (which is what the C# Script runs off I believe) does not auto-garbage-collect. So you need to invoke garbage collection manually from time to time, as you are doing.

         

        But, as far as I'm aware, this isn't an issue with VBScript? Certainly not with normal script units anyway. Don't know about extensions once they're incorporated into the IDE. After you mentioned it, I did hammer my extension creating lots of instances of my custom class while watching the memory footprint of TC and it didn't increase dramatically ....