- Whenever a memory consumer wants to allocate memory to SQL Server, then it has to go through a memory clerk instead of going directly into the memory node.
- There are general memory clerks like MEMORYCLERK_SQLGENERAL, but any component is required to allocate significant amounts, which will be written to create and use their own memory clerk.
- we can say that memory clerks are consumers of memory.
- For example, the buffer pool has its own memory clerk (MEMORYCLERK_SQLBUFFERPOOL), as does the query plan (MEMORYCLERK_SQLQUERYPLAN), which makes troubleshooting very easy because you can see the memory allocation made by each clerk and see who having what’s.
- we can find and see the details of all the memory clerks in SQL Server using the sys.dm_os_memory_clerks DMV.
Below Script provides the details about memory clerks in SQL Server:-
SELECT [type], memory_node_id, pages_kb, virtual_memory_reserved_kb, virtual_memory_committed_kb, awe_allocated_kb FROM sys.dm_os_memory_clerks ORDER BY virtual_memory_reserved_kb DESC;