To conserve memory, you should try to minimize the number of objects in your KB. It is more efficient to use arrays and lists, or sequences and structures than it is to use objects because the memory needed to store another value in an array or list is minimal, compared to the memory needed to create an entirely new object. For example, instead of storing data as 1000 objects, each with four attributes, consider storing the information as 4 value arrays, each with 1000 elements, thus saving 996 objects. Alternatively, you can store all the information in a single array or list by storing each item's information as four consecutive values. It is also more efficient to use messages as the superior class of user-defined classes, as opposed to objects, when you do not need an iconic representation of the object.
Also, try to define objects with subobjects only when necessary. It is more memory-efficient to have an object with ten attributes, rather than an object with five attributes, each of which is a subobject with two additional attributes.
Note that while these techniques minimize memory consumption, they also make your application more difficult to understand and debug. Therefore, you should only employ these techniques when memory consumption is a critical issue.
For more information, see the references in this table:
Hide Name Boxes and Attribute Displays
Name boxes, which are the visible name of an item on a workspace, and attribute displays, which are the visible displays of item attributes, consume a surprising amount of memory, approximately 300 bytes. To conserve memory, try to minimize the number of items with name boxes and attribute displays.
Minimizing Non-Functional Items
To reduce the size of your module, you should minimize the number of non-functional items, such as free text, workspaces, "go to workspace" buttons, and so on.