SYS_GetMemoryInfo Function

Action

Returns performance information on Windows.

Availability

Windows only.

This functionality is supported only if you are using the Classic Agent. For additional information, refer to the Silk Test Classic Classic Agent Help.

Syntax

lBytes = SYS_GetMemoryInfo (myWndTag, Counter)
Variable Description
lBytes The number of bytes of the performance counter specified by Counter. LONG.
myWndTag The window. WNDTAG.
Counter The performance counter. MEMINFO.

Notes

SYS_GetMemoryInfo returns one of the four Windows performance counters associated with the process that owns the window specified with myWndTag. Specify the performance counter with Counter, which is of type MEMINFO, an enumerated data type with four possible values:

Value Description
WORKING_SET The process's working set, that is, the number of bytes displayed in the Mem Usage column on the Processes tab in the Task Manager.
VIRTUAL_SIZE The largest address in the process's virtual address space.
PRIVATE_READWRITE The number of bytes of writeable, committed (that is, really allocated) memory in the process's address space.
PRIVATE_BYTES The number of bytes of private (unshared) memory in the process's address space.

In all cases, the returned value is in bytes.

You can use this function (most likely with WORKING_SET or PRIVATE_READWRITE) to get an indication of whether the application under test has a memory leak.

SYS_GetMemoryInfo is executed by the Agent process, not the Silk Test Classic process. To affect the host process, use the function with the hHost notation or machine handle operator. For more information about the machine handle operator and hHost, see Machine handle operator.

The Open Agent supports all SYS functions with the exception of SYS_GetMemoryInfo. SYS_GetMemoryInfo defaults to the Classic Agent when a script is executed.

Example

LONG lMem
lMem = SYS_GetMemoryInfo ("/[MainWin]Test Application",WORKING_SET)
Print ("Working set: {lMem}")