摘要 |
Centrally handling a runtime error or exception of a program using a central object stack and exception handling code centrally maintained within a global object manager. The global object manager is a data structure separate from the program's call stack. When a modified TRY statement is executed, a location is marked on the central object stack. During execution of a section of code after the modified TRY statement, if a new object is needed, the global object manager efficiently allocates the new object. The global object manager either allocates the new object directly from memory or attempts to re-use a previously allocated object in a cache of available objects as the new object. The new object is then registered on the central object stack and a pointer to the new object is registered on the program's call stack. This keeps the new object and associated exception handling code off the program's call stack.When an exception is thrown, the global object manager cleans up and unregisters an object which was registered on the central object stack since the marked location. If a re-use condition is met, the object is kept in the cache as an available object already allocated from memory. However, if the re-use condition is not met, the object is de-allocated from memory.
|