Hello Guest it is March 28, 2024, 08:35:52 AM

Author Topic: How to stop garbage collection?  (Read 3993 times)

0 Members and 1 Guest are viewing this topic.

How to stop garbage collection?
« on: July 29, 2009, 12:44:18 PM »
Is there any way to preserve objects / variables in separate scripts contained within mach3 buttons after termination of the script? 

I've created an mscomm object in a button script to open a serial port, but it kills the object when the script terminates, requiring repetitive recreation of this object and repetitive opening/closing of the port as a result.

What is the typical method for sharing or preserving variable/object information between independant scripts?  Is it possible?
Re: How to stop garbage collection?
« Reply #1 on: July 29, 2009, 05:53:54 PM »
Not possible. Each instance of a button is a one time, run and delete.

Ive spent several hours leaning on Brian to fix that. He is sympathetic to the issue, but he seems to find other things to keep him busy. Maybe someday he will get to this.

vmax549

*
Re: How to stop garbage collection?
« Reply #2 on: July 30, 2009, 11:05:13 AM »
Could you load the needed code to support the port into the macro pump, then preserve VARS into the Gcode Vars where you have access from all over???

Just a thought, (;-) TP

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: How to stop garbage collection?
« Reply #3 on: July 30, 2009, 11:38:53 AM »
Perhaps you could build your com object as a standalone object (or thread?) Active X or what ever, then in a Plugin you can access that object, and from your buttons you can send various "NotifyPlugins()" codes to do different things to/from your object from the plugin depending on how bad you really want something like that.

scott
fun times