Repetitive Action Problems

Application errors that only reveal themselves after an action has been performed many times typically result from the application exceeding an operating system or Presentation Manager resource constraint. Resources such as window handles, presentation spaces, memory objects and so on, have finite limits. If an application repeatedly requests allocation of such resources without releasing them, these limits may be exceeded, in which case the resource will not be allocated and the application may fail when attempting to use the resource.

Such problems may manifest themselves as Trap 000D errors that will result in application termination, or may simply corrupt execution of the application. The effect is dependent upon the (invalid) contents of the resource handle when the application issues a function call that uses the resources. In certain cases, a function call may cause the application to enter an endless loop within the processing of one message, in which case the entire Presentation Manager desktop may "lock up".

This problem may be avoided by ensuring that all resource requests (DosGet...() and WinGet...() function calls) in the code are matched by corresponding DosRelease...() and WinRelease() function calls. In accordance with the principle of encapsulating function, resources required for processing a particular message should be allocated, used and released during the processing of that message.

An exception to this rule occurs in the case of resources such as control blocks, presentation spaces for display windows, etc. These are typically allocated during processing of the WM_CREATE message, and persist throughout the life of the window, until released during processing of the WM_DESTROY message.


[Back: First Time Problems]
[Next: Post-Resolution Action]