I am running a stored procedure in query builder and closing query builder. However, the memory allocated doesn't get released. The stored procedure uses temp tables and drops them immediately after its use. These tables get created in a loop, get truncated, and dropped immediately. Any table that is created gets dropped immediately. The purpose of the stored procedure is only to make updates after a calculation using these temp tables.

After each execution, about 1.4 GB memory increases and never get released.


  1. What factors should be considered when creating temp tables in a stored procedure ?
  2. How can I claim memory after the stored procedure gets executed ?
  • 2
    Which database platform is this question for? – SQLRockstar Dec 18 '13 at 15:30
  • SQL Server 2008 R2 – Naresh Dec 18 '13 at 15:48

SQL Server doesn't release the memory it consumes unless it gets an order from the operating system to do so.

If you need, you can set the maximum amount of memory SQL Server will consume.

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.