| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (8 out of 13)

Error Object Memory Management

During KB execution, error objects can be instantiated in indefinitely large numbers. Such objects must not be allowed to accumulate without limit, or the resulting memory leak will eventually consume all memory and abort G2.

When the system-defined default error handler receives a transient error object, it automatically deletes the object before returning. In all other cases, code that signals and handles errors must explicitly delete error objects as needed to prevent them from accumulating.

Since G2 cancels execution of a block that signals an error, the code that deletes an error object cannot follow the signal statement in that block. The most convenient place to delete an error object is in the error handler that receives it. Any other technique will do as well, provided that it can never fail.

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (8 out of 13)

Copyright © 1997 Gensym Corporation, Inc.