The GetMemoryUsage method returns an approximate amount of
memory currently allocated for the specified client session. This includes
the client session structure, dynamically allocated session data, cached
model information, and message history retained by the session.
This method is primarily intended for diagnostics, monitoring, and
testing. Applications that maintain long-running sessions or retain large
message histories can use this method to monitor how much memory is being
used by a client session.
The value returned by this method is rounded up to the nearest system
page size and should be treated as an estimate of memory usage rather than
an exact byte-for-byte allocation total.
The lpMemUsage parameter points to a LARGE_INTEGER structure. The
memory usage value is returned in the QuadPart member. In languages that
support 64-bit integer values directly, it is safe to pass a pointer to a
compatible 64-bit integer variable.
The memory usage reported by this method is limited to memory allocated
for the specified client session. It does not include memory used internally
by the operating system, networking libraries, provider services, or other
process-wide resources.