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.