We have set a memory cap limit of 43GB in SQL server instance, so thereafter it keeps 42 GB near about and keeps near about 1 GB for its processing operations. But then we received near about 500,000 record to process via one of our external application, and then due to lack of memory space our system start to log the

Out of Memory exception (An exception of type 'System.OutOfMemoryException' occurred and was caught).

In this case we restart SQL server instance and it works correctly for some days, but thereafter it reaches to its max memory cap limit the same issue continues and we restart server again and it continues.

Is there any way we can get rid of this.

Please Help!

enter image description here

  • 2
    System.OutOfMemoryException exception is thrown by the client application, not SQL Server. Are you running the application on the same box as SQL Server? How much physical RAM on the server? The max server memory should be reduced to account for both OS needs and other applications running on the server. – Dan Guzman Oct 28 '15 at 12:22
  • 1
    With what you suggested it seems issue is with application. It might be leaking memory. What is total RAM on the windows box. What is output of Select @@Version. – Shanky Oct 28 '15 at 12:27
  • @DanGuzman , No, application(windows service) and SQL Server both are on seprate boxes. System on which client application is running have 28GB of RAM, and System on which SQL server is host have 56GB of RAM. and we set max server memory 43 GB there on box where sql server is hosted. – user3772245 Oct 28 '15 at 12:52
  • @Shanky, System on which client application is running have 28GB of RAM, and System on which SQL server is host have 56GB of RAM. – user3772245 Oct 28 '15 at 12:56
  • @user3772245, barring an error in SQLCLR, the exception is on the client side, not SQL Server. – Dan Guzman Oct 28 '15 at 13:05

I agree with Dan and Shanky on this being more of an application issue. Check out How Much Memory SQL Server Needs for a good guideline on how to set the SQL Max Memory setting: "reserve 1 GB of RAM for the OS, 1 GB for each 4 GB of RAM installed from 4–16 GB, and then 1 GB for every 8 GB RAM installed above 16 GB RAM. Then monitor the Memory\Available MBytes performance counter in Windows to determine if you can increase the memory available to SQL Server above the starting value."

  • This would not actually answer the question IMHO. Its quite possible that application is leaking memory and changing max server memory would not be solution. – Shanky Oct 28 '15 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.