LlmGetMemoryUsage Function  
 
BOOL WINAPI LlmGetMemoryUsage(
  HCLIENT hClient,  
  PLARGE_INTEGER lpMemUsage  
);

The LlmGetMemoryUsage function returns the number of bytes of memory allocated for the client session.

Parameters

hClient
A handle to the client session.
lpMemUsage
A pointer to a LARGE_INTEGER variable which will contain the number of bytes allocated for the client session when the function returns. This parameter cannot be NULL.

Return Value

If the function succeeds, the return value is non-zero. If the function fails, the return value is zero. To get extended error information, call LlmGetLastError.

Remarks

The LlmGetMemoryUsage function 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 function is primarily intended for diagnostics, monitoring, and testing. Applications that maintain long-running sessions or retain large message histories can use this function to monitor how much memory is being used by a client session.

The value returned by this function 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 function 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.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: csllmv12.lib

See Also

LlmClearHistory, LlmGetHistorySize, LlmSetHistorySize