Friday, March 30, 2012

How to control CLR memory threshhold?

Please help!

I'm running a lengthy (about 5 minutes) transformation process on SQL Server 2005, which consumes about 300-400 MB. The code is a C# SP. The same code can be run as a part of WinForm application and works fine. If executed as a stored procedure e.g. from Management Studio it breaks after consuming certain amount of memory above roughly 200MB with

.NET Framework execution was aborted by escalation policy because of out of memory.

The SP works fine on smaller amount of data. The assembly has UNSAFE permission and DB's TRUSTWORTHY attribute is OFF/false. Timeout is set to 10 minutes.

If it's memory limit, how can it be increased? Consumption is well below server limitations. The server is Windows 2003 with 3.5 GB of RAM on Intel Xeon.

Thanks, Andrei Kuzmenkov.

Hi Andrei,

I wrote a blog entry touching on this topic here: http://blogs.msdn.com/sqlclr/archive/2006/03/24/560154.aspx

You can increase the amount of memory available to SQLCLR via the -g flag on Sql Server start-up, as described in BOL: http://msdn2.microsoft.com/en-us/library/ms190737.aspx. Be aware of the trade-offs however, as increasing memory_to_reserver decreases the amount of memory available to the main SQL Buffer pool.

Steven

|||

Thank you Steven for the prompt response.

That'd helped immediately.

Andrei Kouzmenkov.

No comments:

Post a Comment