Try OpenEdge Now
skip to main content
Developing WebSpeed Applications
SpeedScript : Elements of SpeedScript syntax : Block context and resource scope : Dynamic resources
 
Dynamic resources
In general, dynamic resources are resources that you implicitly or explicitly create and delete at run time. Record buffers that a FOR statement implicitly defines are dynamic buffers. WebSpeed creates them when the FOR block executes and deletes them when its execution completes. SpeedScript frames scoped to a FOR block are dynamic in the same way. The whole context of a procedure is dynamic. WebSpeed creates its local data resources when you call the procedure and deletes them when the procedure returns or otherwise goes out of scope.
However, WebSpeed allows you to create and delete certain dynamic resources explicitly. For WebSpeed, this especially applies to the external procedure contexts (persistent procedures) of Web objects. In general, the scope of a dynamic resource lasts from the time you create it to the time you delete it or when the WebSpeed agent session ends, whichever occurs first. When a procedure block completes execution and its context goes out of scope, this does not affect the scope of any dynamic resources that you have created in that context. The completion of the procedure can only affect whether the resources are still accessible from the context that remains.
WebSpeed allows you to define handles to most dynamic resources. These handles are variables that point to the resources you have created. You must ensure that handles to these resources are always available to your application until you delete the resources. If you create a persistent procedure context and do not explicitly delete it, the context remains in scope for the duration of the agent session, no matter what client accesses it. If you also lose the original handles to these procedure contexts, you might not be able to access them again. If you cannot access them, you cannot delete them, and in effect, they become memory lost to WebSpeed and the system (that is, a memory leak).