Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 ?
share|improve this question
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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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