I have a project where I am using the Navigation Tabs and I need certain tabs to blink based on whether certain alarms exist in the system.
I was able to get them to blink by setting up custom properties in the Root Container of the window that contains the Navigation Tabs. The custom properties are the tab colors and are bound to an expression that will change the color based on a “Blink” tag that changes once per second. The Navigation Tabs use the Cell Update binding to link the color to the custom property. This works fine EXCEPT that this causes the CPU usage of the client to (over a period of about 2-3 hours) increase to a point where the computer running the computer is unresponsive.
The CPU increase is absolutely caused by the Cell Update. If I leave the whole project alone but remove this binding, the client will run endlessly without problem.
I decided to try a different method. I am using the propertyChange script in the Root Container. When the color in the custom property changes, the navigation tab colors are adjusted. In testing, this method is no better and the CPU usage starts to climb pretty quickly.
I am running the server on a Windows 7 64-bit machine. It is using version 7.9.10. I have found two previous posts where people saw this same problem.
Does anybody know a method for doing this that will not cause the CPU usage to become completely unstable?
Well, that would be a memory leak. Nailing it down would take a very detailed look at your system. And fixing it would probably require IA’s involvement. Aside from involving IA, consider trying to minimize the creation of objects in you blink subsystem, like color objects. I would create custom color properties for each color you will use in your backgrounds, and have the blinking colors’ expressions simply select from those instead of converting from strings everywhere. That will limit the blinking’s object creating to just the dataset driving the tabs. Consider also using a timer event or timer component to consolidate that dataset construction to a single event script, blinking everything together in a single dataset change. That also eliminates the use of cell update bindings, which make a new dataset object on every evaluation of the binding.
I know that the memory leak is coming from the Cell Update since if I turn off that binding, the memory leak goes away. I have tried to get IA involved but they were unable to get anywhere with the problem. This is why I am now turning to the forums.
I am also using color properties. I have a custom color property that is the default color and one for the alarm color. Based on the “Blink” state, it sets the color to used in the Cell Update to the correct custom property.
I have now switched to scripting, instead of the cell update. I have added a Blink custom property to the Navigation Tabs. When this property changes, it will update all the tab colors in one shot. This causes the dataset to only get updated once per blink. I have to give it some time to run to see if this “fixes” the issue.
I changed the script so that it fires on the propertyChange for the “Blink” property. When it fires, it updates the colors in the Navigation Tabs dataset. I slowed the blinking down to once every 1.5 seconds.
This still doesn’t fix the problem. After about 1 hour to 1.5 hours, the CPU usage by the client has noticeably climbed and the memory usage continues to climb.
I feel like I am out of options on this. The only way to update the colors of the tabs is by rewriting the entire dataset. Even when this dataset update is reduced to only as often as the blink rate, the memory leak still exists. This seems like a bug to me. Updating a 7 row dataset once every 1.5 seconds should not cause the client to use up all the available memory and CPU.
Is there anyway to update the dataset instead of rewriting it? I already know the answer is no, but I thought I would ask. Is there any other way to update the tab colors that I am not thinking of? Worst case, I will remove the blinking tabs and switch to something that doesn’t require a dataset update to work.
Technically, yes, but effectively, no. Most dataset objects have a setValueAt() method that can change data in place. It is only safe to use before the dataset is assigned to a property, as such changes after the fact will typically be ignored. (They don’t trigger a propertyChange.)
Try setting all of those tabs backgrounds to transparent, and change the color of a rectange behind it.