We have a sql server 2008 box.
On this server we have a scheduled job that calls a large stored procedure that opens xml files and loads them into tables.
After an extended period of up time the SQL server consumes literally all the available memory. (in fact the page file nearly ate all the disc space)
Is it possible for a stored proc to leak memory?
Is it possible for an SSIS package to leak memory?
Thanks in advance!!
Yes, a memory leak is possible if you forget to call
sp_xml_removedocument(for each matchingsp_xml_preparedocument):Example usage:
Another form of memory leak is forgetting to both close and deallocate a cursor:
[Note: I rarely use cursors. Wherever possible and appropriate I always try to do it the set-based way]
Just for the record, even though I always like to see an explicit
CLOSEandDEALLOCATEfor cursors: