Working with python datatypes across multiple Vision windows?

In vision, you can attach arbitrary objects to windows and components with Swing’s .putClientProperty() method. Many examples here on the forum.

In the gateway and for certain cases in Vision clients, you can use system.util.getGlobals() to stash arbitrary objects. However, there are some gotchas:

  • Actual persistence of getGlobals has varied across versions. Badly broken in the middle of v7.9 all the through early v8.1. I created a work-around for those who need it via system.util.persistent. Also on this forum.

  • Placing anything in any persistent dictionary that isn’t a native jython type or java object risks huge memory leaks. Especially true for python class instances. They must be replaced with updated instances whenever your scripts reload or the entire previous interpreter will get stuck in memory.

  • Long-running threads that work with persistent objects need to be interruptible/joinable on demand, or they will also leak entire interpreters.

Edit: Welcome to the bowels of Ignition! /:

2 Likes