Selecting Unreferenced Objects

Selecting Unreferenced Objects

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

Selecting Unreferenced Objects

Objects can be selected based on whether or not they are referenced by another object by using the selection operator “u”. An unreferenced object is an object that is not depended on by any other object; e.g., a variable which is not used in a program, relationship, role condition, or a virtual field is ” unreferenced”. For example, in the following command, all unreferenced objects are selected for use by the ZOMLIST service:

ZOMList +p u

Generally, unreferenced objects are unused by a program, but this is not always so. For example, the main menu of a program can be unreferenced, because it is, by definition, the starting point of the application. Similarly, object references hidden in Zim macros are not detectable. Nevertheless, the unreferenced criteria is a great assistant in identifying objects that are no longer needed in an application, and helps the process of clean up.

An example of how to effectively use the unreferenced criteria is shown below. Upon reviewing the results of the ZOMList command above, we determined that all unreferenced objects but ” pMainMenu” are no longer needed. Instead of destroying these objects, they are assigned the keyword “Garbage”. Then the “Garbage” objects are erased. Erase is a better choice than destroy because you can test the application and recover any needed objects. If a problem arises because some of the “Garbage” objects are actually needed, those objects can be created since ZOMErase does not remove the description from the Object Dictionary.

ZOMSet + pu – n pMainMenu ; k Garbage

ZOMErase + k Garbage

Once the application has been tested following the erase, the final act of cleanup is to destroy the key-worded objects.  The destroy operation removes both the object and its Object Dictionary description.

ZOMDestroy + k Garbage

Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

pt_BRPortuguese