Memory Leak with sp_OACreate and EXECUTE AS OWNER

Hi,
We have been encountering an "Out of Memory" issue with SQL Server 2005, and have tracked it down to the usage of sp_OACreate and sp_OADestroy in a stored procedure. We discovered that logging in and running the procedure as sa, without "EXECUTE AS OWNER" in the procedure worked fine without any memory leak, but the including "EXECUTE AS OWNER" caused the server memory usage to increase, and never be released.

Has anyone else encountered this issue, or have they a solution?

Cheers,
Chris

[540 byte] By [ChrisMcV] at [2007-12-27]
# 1
?

I was able to reproduce this, as well, in SQL

Server 2005 RTM (9.0.1399). I unfortunately don't have an SP1 installation

handy to test with -- are you running SP1? If not, you should try that

first. If you are already running SP1, you should file a bug on

connect.microsoft.com about it, and then post back here with the URL so that I

can vote for it!


--
Adam Machanic
Pro SQL Server

2005, available now
href="http://www.apress.com/book/bookDisplay.html@bID=457">http://www..apress.com/book/bookDisplay.html?bID=457
--

style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

< href="mailto:ChrisMcV@discussions.microsoft.com">ChrisMcV@discussions.microsoft.com>

wrote in message href="news_3A9cb4c8b8-f777-40b3-a1c0-933ef49a32aa_40discussions.microsoft.com">news:9cb4c8b8-f777-40b3-a1c0-933ef49a32aa@discussions.microsoft.com...

Hi,


We have been encountering an "Out of Memory" issue with SQL Server 2005,

and have tracked it down to the usage of sp_OACreate and sp_OADestroy in a

stored procedure. We discovered that logging in and running the procedure as

sa, without "EXECUTE AS OWNER" in the procedure worked fine without any memory

leak, but the including "EXECUTE AS OWNER" caused the server memory usage to

increase, and never be released.

Has anyone else encountered this

issue, or have they a solution?

Cheers,


Chris

MVPUser at 2007-9-4 > top of Msdn Tech,SQL Server,SQL Server Database Engine...
# 2
I'm downloading SP1 now. Will inform of progress with that, I can't find the link to actually submit the bug on connect.microsoft.com.... maybe i'm looking too hard.

thanks,
chris

ChrisMcV at 2007-9-4 > top of Msdn Tech,SQL Server,SQL Server Database Engine...
# 3
Can confirm the issue is resolved in SP1!! Hooray for undocumented fixes
ChrisMcV at 2007-9-4 > top of Msdn Tech,SQL Server,SQL Server Database Engine...
# 4
?

Great, thanks for following up on that. Good

to know in case I see the issue again anywhere!


--
Adam Machanic
Pro SQL Server 2005, available now
href="http://www.apress.com/book/bookDisplay.html@bID=457">http://www..apress.com/book/bookDisplay.html?bID=457
--

style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

< href="mailto:ChrisMcV@discussions.microsoft.com">ChrisMcV@discussions.microsoft.com>

wrote in message href="news_3Ad5e87957-b656-43e6-acd2-7f0dcbc79d92_40discussions.microsoft.com">news:d5e87957-b656-43e6-acd2-7f0dcbc79d92@discussions.microsoft.com...

Can

confirm the issue is resolved in SP1!! Hooray for undocumented

fixes

MVPUser at 2007-9-4 > top of Msdn Tech,SQL Server,SQL Server Database Engine...
# 5

Hi

I observed the same behavior with my program SQL 2005 express grabbing memory continuously and not releasing. I had a program which posts 1 million records to database and I can see the memory grows from 27MB to 400 MB. I can limit the memory of server using

EXEC sys.sp_configure N'max server memory (MB)', N'50'

GO

RECONFIGURE WITH OVERRIDE

GO

After applying above command to the database the memory size is restricted to ~ 84MB for the same test.

By default configuration for SQL 2005 express was to use 2147483647 MB (too much) memory which causes SQL to grab the new memory and doesn't reuse the existing one.

MaheshAAH at 2007-9-4 > top of Msdn Tech,SQL Server,SQL Server Database Engine...

SQL Server

Site Classified