Edit

Share via


sys.dm_os_out_of_memory_events

Applies to: Azure SQL Database Azure SQL Managed Instance

Returns a set of recent out of memory (OOM) events.

For more information on out of memory conditions in Azure SQL Database, see Troubleshoot out of memory errors in Azure SQL Database.

Column name Data type Description
event_time datetime OOM event time. Is not nullable.
oom_cause tinyint A numeric value indicating OOM root cause. OOM cause is determined by a heuristic algorithm and is provided with a finite degree of confidence. Is not nullable.
oom_cause_desc nvarchar(30) Description of oom_cause. Is not nullable.
0. UNKNOWN - OOM cause could not be determined
1. HEKATON_POOL_MEMORY_LOW - Insufficient memory in the resource pool used for In-Memory OLTP. For more information, see Monitor In-Memory OLTP.
2. MEMORY_LOW - Insufficient memory available to the database engine process
3. OS_MEMORY_PRESSURE - OOM due to external memory pressure from the operating system
4. OS_MEMORY_PRESSURE_SQL - OOM due to external memory pressure from other database engine instance(s)
5. NON_SOS_MEMORY_LEAK - OOM due to a leak in non-SOS memory, for example, loaded modules
6. SERVERLESS_MEMORY_RECLAMATION - OOM related to memory reclamation in a serverless database
7. MEMORY_LEAK - OOM due to a leak in SOS memory
8. SLOW_BUFFER_POOL_SHRINK - OOM due to the buffer pool not releasing memory fast enough under memory pressure
9. INTERNAL_POOL - Insufficient memory in the internal resource pool
10. SYSTEM_POOL - Insufficient memory in a system resource pool
11. QUERY_MEMORY_GRANTS - OOM due to large memory grants held by queries
12. REPLICAS_AND_AVAILABILITY - OOM due to workloads in SloSecSharedPool resource pool
available_physical_memory_mb int Available physical memory, in megabytes. Is not nullable.
initial_job_object_memory_limit_mb int Job object memory limit on database engine startup, in megabytes. For more information on Job Objects, see Resource governance. Nullable.
current_job_object_memory_limit_mb int Job object current memory limit, in megabytes. Nullable.
process_memory_usage_mb int Total process memory usage in megabytes by the instance. Is not nullable.
non_sos_memory_usage_mb int Non-SOS usage in megabytes, including SOS created threads, threads created by non-SOS components, loaded DLLs, etc. Is not nullable.
committed_memory_target_mb int SOS target memory in megabytes. Is not nullable.
committed_memory_mb int SOS committed memory in megabytes. Is not nullable.
allocation_potential_memory_mb int Memory available to the database engine instance for new allocations, in megabytes. Is not nullable.
oom_factor tinyint A value that provides additional information related to the OOM event, for internal use only. Is not nullable.
oom_factor_desc nvarchar(30) Description of oom_factor. For internal use only. Is not nullable.
0 - UNDEFINED
1 - ALLOCATION_POTENTIAL
2 - BLOCK_ALLOCATOR
3 - ESCAPE_TIMEOUT
4 - FAIL_FAST
5 - MEMORY_POOL
6 - EMERGENCY_ALLOCATOR
7 - VIRTUAL_ALLOC
8 - SIMULATED
9 - BUF_ALLOCATOR
10 - QUERY_MEM_QUEUE
11 - FRAGMENT
12 - INIT_DESCRIPTOR
13 - MEMORY_POOL_PRESSURE
14 - DESCRIPTOR_ALLOCATOR
15 - DESCRIPTOR_ALLOCATOR_ESCAPE
oom_resource_pools nvarchar(4000) Resource pools that are out of memory, including memory usage statistics for each pool. This information is provided as a JSON value. Nullable.
top_memory_clerks nvarchar(4000) Top memory clerks by memory consumption, including memory usage statistics for each clerk. This information is provided as a JSON value. Nullable.
top_resource_pools nvarchar(4000) Top resource pools by memory consumption, including memory usage statistics for each resource pool. This information is provided as a JSON value. Nullable.
possible_leaked_memory_clerks nvarchar(4000) Memory clerks that have leaked memory. Based on heuristics and provided with a finite degree of confidence. This information is provided as a JSON value. Nullable.
possible_non_sos_leaked_memory_mb int Leaked non-SOS memory in megabytes, if any. Based on heuristics and provided with a finite degree of confidence. Nullable.

Permissions

On Azure SQL Managed Instance, requires VIEW SERVER PERFORMANCE STATE permission.

On SQL Database Basic, S0, and S1 service objectives, and for databases in elastic pools, the server admin account, the Microsoft Entra admin account, or membership in the ##MS_ServerPerformanceStateReader## server role is required. On all other SQL Database service objectives, either the VIEW DATABASE PERFORMANCE STATE permission on the database, or membership in the ##MS_ServerPerformanceStateReader## server role is required.

Remarks

Each row in this view represents an out of memory (OOM) event that has occurred in the database engine. Not all OOM events might be captured. Older OOM events can disappear from the result set as more recent OOM events occur. Result set is not persisted across restarts of the database engine.

Currently, this DMV is visible but not supported in SQL Server 2022 (16.x) and SQL Server 2025 (17.x) Preview.

summarized_oom_snapshot extended event

The summarized_oom_snapshot extended event is a part of the system_health event session to simplify detection of out of memory events. Each summarized_oom_snapshot extended event corresponds to a row in sys.dm_os_out_of_memory_events. For more information, see Blog: A new way to troubleshoot out-of-memory errors in the database engine.

Examples

A. Get all available OOM events

The following example returns all event data ordered by the most recent time for the database engine hosting the currently connected database.

SELECT *
FROM sys.dm_os_out_of_memory_events
ORDER BY event_time DESC;

B. Get top memory clerks for each OOM event

The following example returns a subset of event data and expands the JSON data in the top_memory_clerks column. Each row in the result set represents a top memory clerk for a specific OOM event.

SELECT event_time,
       oom_cause_desc,
       oom_factor_desc,
       oom_resource_pools,
       top_resource_pools,
       clerk_type_name,
       clerk_page_allocated_mb,
       clerk_vm_committed_mb
FROM sys.dm_os_out_of_memory_events
CROSS APPLY OPENJSON(top_memory_clerks)
                    WITH (
                         clerk_type_name sysname '$.clerk_type_name',
                         clerk_page_allocated_mb bigint '$.page_allocated_mb',
                         clerk_vm_committed_mb bigint '$.vm_committed_mb'
                         )
ORDER BY event_time DESC, clerk_page_allocated_mb DESC;

C. Get top resource pools for each OOM event

The following example returns a subset of event data and expands the JSON data in the top_resource_pools column. Each row in the result set represents a top resource pool for a specific OOM event.

SELECT event_time,
       oom_cause_desc,
       oom_factor_desc,
       oom_resource_pools,
       top_memory_clerks,
       pool_name,
       pool_allocations_mb,
       pool_target_mb,
       pool_is_oom
FROM sys.dm_os_out_of_memory_events
CROSS APPLY OPENJSON(top_resource_pools)
                    WITH (
                         pool_name sysname '$.pool_name',
                         pool_allocations_mb bigint '$.allocations_mb',
                         pool_target_mb bigint '$.pool_target_mb',
                         pool_is_oom bit '$.is_oom'
                         )
ORDER BY event_time DESC, pool_allocations_mb DESC;