memoryclerks vs memoryobject vs memory pools

sakuraime 2,316 Reputation points
2020-08-25T03:27:20.543+00:00

Hi all , just want to know the difference of memory clerks and memory objects and what's are their relationship ?
20017-memory.jpg

19958-memorypool.jpg

another question is why virtual_memory_committed_kb is much less than pages_kb??

pages_kb is the size that memory clerks memory are in PHYSICAL MEMORY ?

I would also ask questions on memory pools sys.dm_os_memory_pools, pool_id 0 is the internal pool ? pool_id 1 is default pool ? is it referring resource default /internal pool ?. how it's mapped with memory clerk ?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,676 questions
0 comments No comments
{count} votes

7 answers

Sort by: Most helpful
  1. m 4,271 Reputation points
    2020-08-25T07:58:35.753+00:00

    Hi @michaelchau,

    Hi all , just want to know the difference of memory clerks and memory objects and what's are their relationship ?

    Memory clerk: Memory Clerk is used to allocate memory, and is used to classify the memory out of Allocate
    Memory object: The menory object is essentially a heap, which is allocated by Page Allocator. It can be viewed through the DMV of sys.dm_os_memory_objects. This DMV can see a column of Page_Allocator_Address. This column is the identity of the Memory Clerk, indicating which Memory this Memory Object is from. Clerk assigned it.
    Relationship: Memory object can be viewed through the DMV of sys.dm_os_memory_objects. This DMV can see a column of Page_Allocator_Address. This column is the identity of the Memory Clerk, indicating which Memory this Memory Object is from. Clerk assigned it.
    20107-20200825memory.jpg

    another question is why virtual_memory_committed_kb is much less than pages_kb??

    No. There is no value to compare them, virtual_memory_comitted_kb can also larger than pages_kb in your screenshot.
    20099-20200825no-value-for-comparison.jpg

    pages_kb is the size that memory clerks memory are in PHYSICAL MEMORY ?

    Pages_kb: column names of DMVS’;
    Physical memory: As the name suggests, it is the physical storage space provided by the memory chip. Accessing data stored in physical memory is usually much faster than accessing a hard disk. For SQL Server, data objects that are frequently accessed must be cached in physical memory for a long time in order to achieve optimal efficiency.

    I would also ask questions on memory pools sys.dm_os_memory_pools, pool_id 0 is the internal pool ? pool_id 1 is default pool ? is it referring resource default /internal pool ?. how it's mapped with memory clerk ?

    Although the official documentation does not indicate it , I do not think default poolid is 1 and internal pool_id is 0, because we can check from next screenshot, same address but different id. It is different from definition of resource pool.
    20145-20200825id.jpg

    More information: https://learn.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-os-memory-pools-transact-sql?view=sql-server-ver15

    BR,
    Mia
    If the reply is helped, please do “Accept Answer”.--Mia

    0 comments No comments

  2. sakuraime 2,316 Reputation points
    2020-08-25T10:56:10.18+00:00

    20233-allocatoraddress.jpg

    taking this as a example. why page_kb is not equal to sum of pages_in_bytes , even they are in the same page allocator address ?

    0 comments No comments

  3. m 4,271 Reputation points
    2020-08-27T01:31:23.453+00:00

    Hi @sakuraime ,

    taking this as a example. why page_kb is not equal to sum of pages_in_bytes , even they are in the same page allocator address ?

    pages_kb:Specifies the amount of page memory allocated in kilobytes (KB) for this memory clerk. Is not nullable.

    pages_in_bytes: Amount of memory in bytes that is allocated by this instance of the memory object. Is not nullable.

    BR,
    Mia
    If the reply helped, please do “Accept Answer”.

    0 comments No comments

  4. m 4,271 Reputation points
    2020-08-28T01:35:45.12+00:00

    Hi @sakuraime ,

    Is the reply helpful?

    BR,
    Mia
    If the reply is helped, please do "Accept Answer".--Mia

    0 comments No comments

  5. sakuraime 2,316 Reputation points
    2020-08-28T16:51:00.153+00:00

    pages_kb:Specifies the amount of page memory allocated in kilobytes (KB) for this memory clerk. Is not nullable.

    pages_in_bytes: Amount of memory in bytes that is allocated by this instance of the memory object. Is not nullable.

    so sum(pages_in_bytes)=pages_kb ??