Jaa


sys.dm_os_memory_objects

Returns memory objects that are currently allocated by SQL Server. sys.dm_os_memory_objects is primarily used to analyze memory use and to identify possible memory leaks.

Column name Data type Description

memory_object_address

varbinary(8)

Address of the memory object. Is not nullable.

parent_address

varbinary(8)

Address of the parent memory object. Is nullable.

pages_allocated_count

int

Number of pages that are allocated by this object. Is not nullable.

creation_options

int

Internal use only. Is nullable.

bytes_used

bigint

Internal use only. Is nullable.

type

nvarchar(60)

Type of memory object.

This indicates a component that this memory object belongs to, or the function of the memory object. Is nullable.

name

varchar(128)

Internal use only. Is nullable.

memory_node_id

smallint

ID of a memory node that is being used by this memory object. Is not nullable.

creation_time

datetime

Internal only. NULLABLE.

page_size_in_bytes

int

Size of pages allocated by this object. Is not nullable.

max_pages_allocated_count

int

Maximum number of pages allocated by this memory object. Is not nullable.

page_allocator_address

varbinary(8)

Memory address of page allocator. Is not nullable. For more information, see sys.dm_os_memory_clerks.

creation_stack_address

varbinary(8)

Internal use only. Is nullable.

sequence_num

int

Internal use only. Is nullable.

Permissions

Requires VIEW SERVER STATE permission on the server.

Remarks

Memory objects are heaps. They provide allocations that have a finer granularity than those provided by memory clerks. SQL Server components use memory objects instead of memory clerks. Memory objects use the page allocator interface of the memory clerk to allocate pages. Memory objects do not use virtual or shared memory interfaces. Depending on the allocation patterns, components can create different types of memory objects to allocate regions of arbitrary size.

The typical page size for a memory object is 8-KB. However, incremental memory objects can have page sizes that range from 512 bytes to 8 kilobytes.

Note

Page size is not a maximum allocation. Instead, page size is allocation granularity that is supported by a page allocator and that is implemented by a memory clerk. You can request allocations of 16 KB and larger from memory objects, and the request is eventually directed to the multipage allocator of the memory node.

Examples

The following example returns the amount of memory allocated by each memory object type.

SELECT SUM (pages_allocated_count * page_size_in_bytes) as 'Bytes Used', type 
FROM sys.dm_os_memory_objects
GROUP BY type 
ORDER BY 1 DESC;
GO

See Also

Reference

Dynamic Management Views and Functions
SQL Server Operating System Related Dynamic Management Views
sys.dm_os_memory_clerks

Help and Information

Getting SQL Server 2005 Assistance