SQL Server – Fixing Memory Issues with Failing Queries

sql serverssms

I have a SQL Server 2008 R2 with 8GB of ram and SQL Server is limited to 6GB. It seems to not be releasing the memory its used, and at some point future queries begin to fail. This is a mirrored server and the problem is solved after being failed over. Is there a way to force the Memory to always be released, or a known issue with limiting the memory?

There was a problem with the same server long ago, before SQL Server had a memory limit where it would use and use the memory until it crashed the server.

This is a Windows Server 2008 OS.

Best Answer

SQL Server is kind of a memory hog. You could try clearing the cache, BUT I would highly recommend doing some reading on these commands first before you using them. From what I hear, their can be negative side effects when using these especially in a production environment.

DBCC FREESYSTEMCACHE ('ALL')
DBCC FREEPROCCACHE

Here are some links I found useful:

Difference between FreeProcCache and FreeSystemCache

https://sqlserverperformance.wordpress.com/2009/12/28/fun-with-dbcc-freeproccache/

http://jamessql.blogspot.com/2012/04/clean-sql-server-cache.html