This section offers some techniques for preventing memory leaks from occurring and diagnosing their source.
For detailed information about correcting memory leaks, see the G2 Reference Manual.
create action that does not match with a delete action. Remember, the create action creates a transient item, which remains allocated in memory, unless you either delete it or make it a permanent part of your KB. The best way to prevent leaks is to match every create with a delete within the same procedure. This allows the developer to check for potential leaks by simply visually inspecting the code. The exception to this guideline are procedures whose specific purpose is to create objects.
For example, if you want a procedure to return a list of all items of the class
tank, you have two possibilities:
find-all-tanks() = (class item-list)
find-all-tanks(class item-list)
One approach is to recycle symbols by creating a list of symbols which you recycle when the object requiring a name is deleted.