- Error number
- 701
- Severity
- 19 (resource or software problem)
- State
- Varies (identifies where inside SQL Server the allocation failed)
- Product
- Microsoft SQL Server Database Engine
- Versions
- All supported SQL Server versions (2016 to 2025), Azure SQL Database, Azure SQL Managed Instance
- Category
- Memory
- Last reviewed
- 23 October 2026
On this page
What it means
Error 701 means SQL Server could not get the memory a query needed inside the named resource pool; in most cases the query that failed is the victim, and the cause is elsewhere on the server or in the instance.
Every allocation inside SQL Server belongs to a resource pool: internal for the engine itself, default for ordinary user work, or a Resource Governor pool you created. When an allocation in that pool fails and SQL Server cannot free enough memory in time, the query that asked gets 701. The name in quotes tells you which pool ran out; a user-defined pool with a low memory limit is a very different problem from the default or internal pool.
Microsoft groups the causes into three kinds: pressure from outside the SQL Server process (other applications, an overcommitted virtual machine), memory used inside the process but outside the engine (linked server providers, SQLCLR, extended procedures, injected DLLs), and one engine component using far too much (large query memory grants, the plan cache, the lock manager). The diagnostics below tell them apart. A single 701 that clears quickly may need no action; repeated 701s on many connections do.
Common causes
- Other applications or services on the same server, or a virtual machine whose memory is overcommitted, leave too little memory for SQL Server.
- Queries with very large memory grants (big sorts and hashes) holding memory in the
MEMORYCLERK_SQLQERESERVATIONSclerk. - A plan cache bloated by many single-use ad hoc plans (
CACHESTORE_SQLCP), or a lock manager holding millions of locks (OBJECTSTORE_LOCK_MANAGER). - Linked server providers, SQLCLR, extended procedures or third-party DLLs loaded into the SQL Server process and using memory the engine cannot see.
- A Resource Governor pool with a low MAX_MEMORY_PERCENT for the workload that runs in it, or an unusual max or min server memory setting.
Diagnose it
Read-only These queries only read metadata and dynamic management views. They do not change data, permissions or configuration, so they are safe to run first.
Which memory clerks use the most memory?
Run it several times, especially while the errors are happening, and compare.
SELECT TOP (15) type, name, memory_node_id,
pages_kb / 1024 AS pages_mb,
virtual_memory_committed_kb / 1024 AS vm_committed_mb
FROM sys.dm_os_memory_clerks
ORDER BY pages_kb DESC; MEMORYCLERK_SQLBUFFERPOOL is normally the largest. A different clerk far above its usual size (for example MEMORYCLERK_SQLQERESERVATIONS, CACHESTORE_SQLCP or OBJECTSTORE_LOCK_MANAGER) is the component to investigate.
Is the operating system short of memory?
SELECT total_physical_memory_kb / 1024 AS total_mb,
available_physical_memory_kb / 1024 AS available_mb,
system_memory_state_desc
FROM sys.dm_os_sys_memory;
SELECT physical_memory_in_use_kb / 1024 AS sql_in_use_mb,
process_physical_memory_low, process_virtual_memory_low
FROM sys.dm_os_process_memory; Available physical memory is low, or process_physical_memory_low = 1, points to pressure from outside the SQL Server process.
Which queries hold or wait for large memory grants?
SELECT mg.session_id, mg.requested_memory_kb / 1024 AS requested_mb,
mg.granted_memory_kb / 1024 AS granted_mb, mg.used_memory_kb / 1024 AS used_mb,
mg.wait_time_ms, t.text AS query_text
FROM sys.dm_exec_query_memory_grants AS mg
OUTER APPLY sys.dm_exec_sql_text(mg.sql_handle) AS t
ORDER BY mg.requested_memory_kb DESC; A few queries with grants of many gigabytes, or many sessions waiting (granted_mb NULL), are the queries to tune.
How are memory limits and pools configured?
SELECT name, value_in_use
FROM sys.configurations
WHERE name IN (N'max server memory (MB)', N'min server memory (MB)');
SELECT pool_id, name, max_memory_kb / 1024 AS max_mb,
used_memory_kb / 1024 AS used_mb, out_of_memory_count
FROM sys.dm_resource_governor_resource_pools; Unusual max or min server memory values, and the pool named in the message: its out_of_memory_count and whether used_mb is at max_mb. A max server memory of 2147483647 is the default (no limit).
What did SQL Server record about recent out-of-memory events?
SELECT event_time, oom_cause_desc, available_physical_memory_mb,
oom_resource_pools, top_memory_clerks
FROM sys.dm_os_out_of_memory_events
ORDER BY event_time DESC; Each recorded out-of-memory event with a predicted cause and the top memory clerks at the time. Microsoft notes the cause is a heuristic, so confirm it with the other checks.
How to fix it
Each fix is labelled with what it changes. Try read-only checks and the least invasive fix first, and test changes outside production.
Reduce what the biggest consumer uses
Client or network sideAct on the clerk the diagnostics point to. For large memory grants, tune the queries (indexes, fewer rows sorted or hashed, accurate statistics). For a plan cache full of single-use plans, parameterise the queries (sp_executesql or stored procedures). For the lock manager, shorten transactions and make queries touch fewer rows. For pressure from outside, stop, move or limit the other applications.
Move in-process components out of SQL Server
Changes configurationIf sys.dm_os_loaded_modules and the gap between the process private bytes and the engine total server memory point to a DLL, Microsoft suggests running linked server providers out of process (clear the provider's Allow inprocess option) and moving other components out of the SQL Server process where possible.
Caution: Changing a linked server provider option affects every linked server that uses that provider. Test the change on a non-production instance first.
Review memory settings, but only after measuring
Changes configurationDo not change max server memory as a reflex. First measure what the operating system and other processes need and what SQL Server is using (diagnostics 2 and 4). If max server memory is unset and the operating system is starved, or it is set unusually low for the workload, choose a value from those measurements, apply it in a maintenance window and watch the effect. If a Resource Governor pool named in the message is capped too tightly, review that pool rather than the whole instance. If the workload simply needs more memory, the lasting fix is more RAM.
Caution: sp_configure and RECONFIGURE change the whole instance at once. Too low a max server memory starves the buffer pool and slows every database; too high starves Windows. Record the old value so you can revert.
-- Only with a value chosen from measurements (example: 28 GB on a 32 GB server)
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'max server memory (MB)', 28672;
RECONFIGURE;
Examples
A query fails while the instance is under memory pressure
Shown as documented by Microsoft; not reproduced here because it needs real memory exhaustion on the instance. The query that fails is usually not the cause. The level and state a client sees were not observed in the lab, so only the message text (from sys.messages on SQL Server 2025) is shown.
SELECT CustomerId, SUM(Amount) AS Total
FROM dbo.Orders
GROUP BY CustomerId
ORDER BY Total DESC;
There is insufficient system memory in resource pool 'default' to run this query.
How to prevent it
Size the server for the workload and leave room for Windows and anything else that runs on it; on virtual machines, make sure memory is reserved rather than overcommitted. Set max server memory deliberately from measurements, and revisit it when the server or workload changes.
Monitor memory clerks, memory grants and sys.dm_os_out_of_memory_events over time so growth is visible before it fails queries, and tune queries that request large grants. Keep third-party DLLs and in-process providers out of SQL Server where you can.
Common questions
Should I clear the caches with DBCC FREEPROCCACHE?
It can free memory for a moment, but every query must compile again and the cause comes back. Find the clerk that grew and fix that instead.
Is the query in the error message the culprit?
Usually not. It is simply the one that asked for memory when none was left. The memory clerks and memory grants show what is actually using memory.
What does the resource pool name tell me?
Where memory ran out. default is ordinary user work, internal is the engine itself, and any other name is a Resource Governor pool whose memory limit may simply be too low for the work it runs.
Learn more on CodeWithSQL
Official documentation
- MSSQLSERVER_701 (Microsoft Learn)
- Server memory configuration options
- sys.dm_os_memory_clerks
- Troubleshoot memory issues in Azure SQL Database
Last technically reviewed 23 October 2026; examples and diagnostics run on SQL Server 2025 (17.0.1145.4). Message text checked against the engine's sys.messages catalogue.