The Workspace object manages large blocks of memory on behalf of a number of HLU library objects.
Header file: ncarg/hlu/Workspace.h Class name: workspaceClass Class pointer: <Not referenceable> Fortran class function: <Not referenceable> Superclass: Obj Composite classes: <None>
+---------------------------------------------------------------+ | Workspace Resource Set | |---------------------------------------------------------------| | NAME TYPE ACCESS | | CLASS DEFAULT | |===============================================================| | wsMaximumSize NhlTLong RCSG | | WsMaximumSize 16777216 | |---------------------------------------------------------------| | wsThresholdSize NhlTLong RCSG | | WsThresholdSize 4194304 | |---------------------------------------------------------------| | wsCurrentSize NhlTLong RCSG | | WsCurrentSize 0 | +---------------------------------------------------------------+
Most of the time, the Workspace object operates transparently, and you do not need to be concerned with how it works. However, based on the memory resources available to your processes, you may wish to tune the performance of your HLU applications by adjusting the resources of the Workspace object. Since you do not create the Workspace, you cannot get or set any of its resources without first retrieving its object id through a call to the support function NhlGetWorkspaceObjectId.
In order to use the resources of the Workspace object effectively, you should know a little bit about its operation. Plot objects may create and destroy workspaces. Once created, a workspace may be in one of two states: in use or idle. The Workspace object keeps track of the total number of bytes currently allocated for workspaces. You can retrieve this value at any time (after you get the Workspace object id) by getting the value of the resource wsCurrentSize. Any time a plot object requests to use a workspace, the Workspace object checks to see if the request would cause the number of currently allocated bytes to go over a threshold value, as set by the resource wsThresholdSize. If so, the Workspace object looks through the list of idle workspaces, freeing space until either the size of the requested space added to the remaining space no longer causes wsThresholdSize to be exceeded or no more idle workspaces remain. Note that the HLU writer can specify that the contents of a workspace be preserved. In this case, the Workspace object writes the contents of the workspace to a file before freeing the space.
Notice that wsThresholdSize puts no limit on the total memory space available to workspaces that are currently in use. However, depending on the number of separate plot objects created by the application, smaller values will tend to reduce the total amount of space in use at a single time, at a cost of more frequent allocation and deallocation operations on these (potentially very large) memory spaces. The resource wsMaximumSize, on the other hand, specifies the maximum amount of memory the Workspace object allows before returning a fatal error. You can use this resource as a kind of brake that prevents runaway applications from using all the memory resources available in an environment.
NG4.1 Home, Index, Examples, Glossary, Feedback, Ref Contents, Ref WhereAmI?