memoryclerks vs memoryobject vs memory pools

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

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.
8,480 questions
No comments
{count} votes

7 answers

Sort by: Most helpful
  1. answered 2020-08-25T07:58:35.753+00:00
    Miamiao-MSFT 4,216 Reputation points

    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

    No comments

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

    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 ?

    No comments

  3. answered 2020-08-27T01:31:23.453+00:00
    Miamiao-MSFT 4,216 Reputation points

    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”.

    No comments

  4. answered 2020-08-28T01:35:45.12+00:00
    Miamiao-MSFT 4,216 Reputation points

    Hi @sakuraime ,

    Is the reply helpful?

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

    No comments

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

    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 ??