日期:2013-10-10  浏览次数:20431 次


Determine the memory used by a DataWindow or DataStore

It is often necessary to know how much memory a DataWindow or DataStore is using to prevent an "out of memory" error or to facilitate debugging. When the memory usage is known, processing of data or the retrieval of data can be stopped when a maximum limit is reached.

To determine the amount of virtual memory used by a DataWindow or DataStore, the Storage attribute is used. It can be invoked from either of the two methods below:

Dot Notation
dw_control.Object.DataWindow.Storage

Describe
dw_control.Describe("DataWindow.Storage")

Both cases return a string value in bytes of storage used.

NOTE - dw_control can refer to either a DataWindow or DataStore

An example usage would be:

Canceling a query that uses too much storage. You can check this property in the script for the RetrieveRow event in the DataWindow control and cancel a query if it is consuming too much storage. NOTE - This example will inject performance degradation by increasing the retrieve time.