I have also been trying to match memory reported by windows to whats inuse in the database.
I've been using perfmon 'Process\Virtual Bytes[db2syscs]' to see the actucal memory used by DB2 and the following query to try and see where memory is allocated.
I'm still working on this to see how to best match things up. If anyone else has any good ideas or ways to check memory, that would be great.
Code:
SELECT 1,'InstanceMemory Curr', CURRENT_PARTITION_MEM/1024/1024 as MB, CURRENT_PARTITION_MEM/1024 as KB
FROM TABLE (SYSPROC.ADMIN_GET_DBP_MEM_USAGE()) AS T
UNION
SELECT 2,'DB Mem Allocated', INT(VALUE)*4/1024 as MB, INT(VALUE)*4 as KB
FROM SYSIBMADM.DBCFG
WHERE NAME = 'database_memory'
UNION
select 3,'DB Mem Used', SUM(POOL_CUR_SIZE)/1024/1024 as MB, SUM(POOL_CUR_SIZE)/1024 as KB
FROM sysibmadm.snapdb_memory_pool
WHERE POOL_ID in ('BP','CAT_CACHE','DATABASE','LOCK_MGR','OTHER','PACKAGE_CACHE','SHARED_SORT','UTILITY') GROUP BY DB_NAME
UNION
SELECT 4,'Appl Mem Allocated', INT(VALUE)*4/1024 MB, INT(VALUE)*4 KB
FROM SYSIBMADM.DBCFG
WHERE NAME = 'appl_memory'
UNION
select 5,'Appl Mem Used', SUM(POOL_CUR_SIZE)/1024/1024 as MB, SUM(POOL_CUR_SIZE)/1024 as KB
FROM sysibmadm.snapdb_memory_pool
WHERE POOL_ID in ('APPL_SHARED','APPLICATION') GROUP BY DB_NAME
ORDER BY 1;