6

What exactly is the memory that is allocated to the a memory component in SQL Server?

I believed committed memory is the amount of physical memory that is being used, and reserved is the amount of memory in Virtual Address Space that does not yet map to physical memory.

But I am puzzled when it comes to allocated memory. When a memory component requests memory from a Memory Manager, what is the nature of this memory being granted? Real/Physical or VAS?

Here is an example DMV:

SELECT pages_kb AS A
,virtual_memory_committed_kb AS C
,virtual_memory_reserved_kb AS R
FROM sys.dm_os_memory_clerks;

There is no relationship whatsoever between columns A, C and R. Initially I was expecting A = C + R, which implied that A, the allocated memory pages, should start out as memory in VAS, and represent the intent to use this much of memory. But clearly it is not right.

How do I interpret allocated memory? Thanks

4
  • The memory allocated is the one the clerk has assigned to memory objects, the virtual memory committed is the address space which is mapped (which is typically a high watermark for allocated memory. But if a allocation is freed init might not be allocated but still committed. So typically committed is a good indicator for fluctuating allocation numbers at it keeps track of maximum allocation and it's the actual memory pages consumed.
    – eckes
    Jun 25 '17 at 12:16
  • Thanks. So allocated memory IS on the VAS layer, not the physical memory?
    – user99201
    Jun 25 '17 at 13:40
  • Not sure what 'is on VAS layer' means. I would expect committed regions to show up in the page table and allocated memory picks some of those pages (as managed by the clerk).
    – eckes
    Jun 25 '17 at 14:47
  • @eckes Sorry for not being clearer. I was asking if it was physical memory that gets allocated.
    – user99201
    Jun 26 '17 at 2:48
2

What exactly is the memory that is allocated to the a memory component in SQL Server?

Memory allocated is memory given to SQL Server for doing various processing. Allocation is wide terms which means providing memory you should not attach any specific meaning to it.

You are correct committed memory is physical memory used because committed memory is backed by physical memory while reserved memory is memory reserved by process which it thinks it might need it may necessarily not be committed.

When a memory component requests memory from a Memory Manager, what is the nature of this memory being granted? Real/Physical or VAS?

VAS: Virtual address space is total amount of virtual memory a process can see in the system when created.

When SQL Server process requests memory it is first mapped to VAS address in the region. VAS is 8TB for 64 bit system and 4 GB for 32 Bit system. Every process which requests memory sees virtual memory which equal to 4GB or 8 TB as per architecture(32 or 64 bit) it is running on. Now after process is mapped to VAS memory manager finds out physical memory to which it can be mapped and finally commit memory to this process when this is eventually done the memory is allocated and is called physical memory allocated to process.

Virtual_memory_committed: This is virtual memory committed as reported by the clerk.

Virtual_memory_reserved: This is the VM reserved as tracked by the clerk..

Pages_kb: Amount of page memory allocated to process.

I hope this clears few things for you

3
  • Thanks. But what is the proper way to interpret your definition of Pages_kb if I dont attach meaning to the term allocate?
    – user99201
    Jun 26 '17 at 14:53
  • As per MSDN. "Pages_kb" Specifies the amount of page memory allocated in kilobytes (KB) for this memory clerk. So there is no need to Multiply this value with 8KB
    – Midhun C N
    Jun 25 '20 at 7:08
  • @MidhunCN Yes agree, I have corrected it.
    – Shanky
    Jun 25 '20 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy