How to programmatically determine memory usage

  • Does anybody know how to programatically determine the actual memory allocated to a SQL Server instance (either via TSQL or a Windows App).

    SQL-DMO will give you the min and max memory settings, but these are not necessarily the actual amount of memory allocated (e.g if max memory is set higher than the physical memory in the server etc).

    Task manager gives inaccurate figures if SQL Server is using AWE memory.

    Perfmon counters will give you the actual memory allocated, but I haven't found a way to programatically hook into these counters.

  • Check "Target Server Memory (KB)" and "Total Server Memory (KB)" in system table sysperfinfo.

  • Just what I was after.

    Thanks very much Allen.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply