NCL Home > Documentation > Graphics > Resources

Workspace (ws) Resources

wsCurrentSize
You can determine the total size currently allocated for all workspaces managed by the Workspace object at any point in an HLU program by retrieving the value of the read-only resource wsCurrentSize. To do this, you must first get the id of the Workspace object using the NhlGetWorkspaceObjectId function.

Default: 0

wsMaximumSize
This resource specifies the total size in bytes that is allowed to be allocated at any single time for all workspaces managed by the Workspace object during the execution of an HLU program. If the Workspace object is asked to allocate or reallocate a workspace such that this value would be exceeded, the Workspace refuses to attempt the allocation and returns a fatal error. In order to modify wsMaximumSize you must first get the id of the Workspace object using the NhlGetWorkspaceObjectId function. Alternatively, in order to permanently change the size you can put a line such as

*wsMaximumSize : 300000000
into your .hluresfile.

Note that when very large amounts of workspace are required, usually the processing time also increases greatly. Sometimes errors indicating that the workspace is exhausted actually are a symptom of another problem with the code.

Default: 100000000

wsThresholdSize
Whenever the sum of the size in bytes of all currently allocated workspaces exceeds the value of the resource wsThresholdSize, the Workspace object attempts to reduce the total allocation below the threshold size by freeing workspaces that are not currently in use. If it is necessary to keep the data in a workspace, the contents of the workspace will first be written to a file. The total size allocated to workspaces may exceed wsThresholdSize if the total size of workspaces currently in use exceeds the threshold size. In order to modify wsThresholdSize you must first get the id of the Workspace object using the NhlGetWorkspaceObjectId function.

Default: 4194304