Why does SQL Server throw Error 701 after enabling Lock Pages in Memory (LPIM)?

Sai Praneeth Eranti 230 Reputation points
2025-11-23T15:02:15.89+00:00

I have a SQL Server instance with 64 GB physical RAM.

  • LPIM is enabled.
  • max server memory is set to 58 GB.

After LPIM is enabled , started seeing below errors which I didn't expect .

Error: 701, Severity: 17, State: 123.
There is insufficient system memory in resource pool 'default' to run this query.


Before enabling LPIM, this error did not occur. After enabling LPIM, SQL Server seems to consume memory differently.

My question:

  • Why does enabling LPIM cause Error 701 even when there is free physical memory outside SQL Server?
  • Does SQL Server allocate all memory up to max server memory for buffer pool?
  • Does workspace memory come from the configured max server memory or from OS free memory?
  • How does LPIM affect memory grants and overall memory management?

FYI , Before enabling LPIM, the server was stable and not under memory pressure. I enabled LPIM because it is considered a best practice for SQL Server performance also it was a recommendation when I ran "SQL best practices assessment"

SQL Server Database Engine
0 comments No comments
{count} votes

Answer recommended by moderator
  1. Erland Sommarskog 131.1K Reputation points MVP Volunteer Moderator
    2025-11-27T21:02:58.5966667+00:00

    Why does enabling LPIM cause Error 701 even when there is free physical memory outside SQL Server?'

    So did you go back to earlier error logs to see there were any messages about SQL Server being swapped out?

    I would guess that for some reason Windows is not prepared to give SQL Server physical memory. Yes, there might be free memory, but Windows cannot reclaim that physical memory, since SQL Server's memory cannot be swapped out when it has LPIM.

    Does SQL Server allocate all memory up to max server memory for buffer pool?

    It might, depending on the queries executing on the system. That is, SQL Server does not automatically allocate memory up to "Max server memory", only if there is a need to. But once it has allocated that much memory, it will only release memory, if Windows signals that there is memory pressure.

    Does workspace memory come from the configured max server memory or from OS free memory?

    I am not sure what workspace memory you have in mind here.

    How does LPIM affect memory grants and overall memory management?

    I can't see that LPIM directly affects memory grant.

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 82,321 Reputation points Volunteer Moderator
    2025-11-23T17:42:10.8733333+00:00

    Sqlserver memory allocation setting are only for the buffer pool. The buffer pool contains all data pages, sort (order by) even temp data in queries. so sql uses other memory for code, data access, extensions, clr routines etc.

    when running without pinned, checked read write paged memory size to see how much physical memory you need

    1 person found this answer helpful.

  2. Erland Sommarskog 131.1K Reputation points MVP Volunteer Moderator
    2025-11-23T18:22:45.9866667+00:00

    If you go back and look in the SQL Server errorlog before you enabled LPIM, I would not be surprised if you found messages about the SQL Server memory being swapped out to disk. LPIM prevents this from happening.

    LPIM is not always best practice, but it depends If you did not have any problems before, and you have problems now, I recommend that you disable LPIM for SQL Server.

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.