Foxhound is the better* Database Monitor for SQL Anywhere.
*better: More thorough, more relevant, more effective.
...more Alerts, more All Clears, more details, more control in your hands.

Breck Carter
Last modified: July 18, 1996
mail to:

Tracking The Elusive DWObject II

Powersoft advises that you should explicitly DESTROY DWObjects that you reference; see the PowerBuilder 5 Help topic "DESTROY PowerScript Statement" and especially Example 3. Using DWObject as you show on the Web page apparently over-rides the PB memory management. - Kevin Service

Tests indicate that DWObjects do consume memory but they do not seem to cause catastrophic leaks. A script containing a local DWObject variable will cause the amount of available memory to sink when it is executed but only once: If the script is repeatedly executed the free memory does not continue to drop. Also, when the number of rows in the buffer changes and the script is reexecuted, the amount of free memory changes up or down if there are fewer or more rows. This is quite confusing... memory is allocated, and reallocated, but not completely released, and the rules are unclear.

However, the Help does indeed state that DWObjects should be explicitly destroyed:

Destroying objects you didn't create: In some cases, you need to destroy DWObjects and OLEObjects you didn't create. If you refer to functions, properties, or data of a DataWindow DWObject or OLEObject, PowerBuilder manages the object dynamically, creating and destroying it as needed. However, if you create a reference to the embedded object, instead of invoking its functions or accessing its properties, you override the built-in object management and you assume responsibility for destroying the object when you are done.

Example 3. This example uses a DWObject variable to make addressing several properties of an object within a DataWindow more efficient. It destroys the DWObject variable when it is done.

   DWObject d_obj

   d_obj = dw_1.Object.empname
   d_obj.Border = 1
   ... // code that access more properties of empname
   DESTROY d_obj

Breck Carter can be reached by phone at (416) 763-5200 or via email at