In my sql server log (2005 SP4) I have this message every couple of seconds :

"AppDomain XXX [DataBase.dbo[runtime], YYY] is marked for unload due to memory pressure"

Our server :

  • Windows Server 2003 R2 Enterprise Edition SP2
  • 32 Gb RAM
  • Physical Address Extension
  • Intel Xeon CPU X5675 x 2 (6 core) 3.07Ghz

  • Awe enabled

  • We have CLR code in SQL Server
  • -g2048 on startup (I'm no DBA, and this value was set by a former emplyee)

I read many article about memtoleave or vas, but I don't get how to diagnose my problem.

Any idea ?


Microsoft has a KB article about this behavior. You got a 32-bit OS with 32-bit application, so the process' address space is 4 GiB. AWE can be used to access more memory, but it is limited only for buffer pool usage. As per the documentation:

The SQL Server buffer pool can fully utilize AWE mapped memory; however, only database pages can be dynamically mapped to and unmapped from SQL Server's virtual address space and take full advantage of memory allocated through AWE. AWE does not directly help supporting additional users, threads, databases, queries, and other objects that permanently reside in the virtual address space.

Short-term solution: review that your CLR code minimizes memory usage.

For a long-term solution, upgrade to 64-bit.


Kimberly Tripp has written a white paper about CLR stuff from DBA point of view. She's got a few nice queries and Perfmon counters that are of use for tracking CLR resource use.

  • Upgrade seems hard, and reviewing seems hard too, this is old legacy code, I'll try to find which methods are called and get rid of them. – remi bourgarel Apr 23 '14 at 13:26
  • @remibourgarel See if Kimberly's document is of any help. – vonPryz Apr 24 '14 at 12:17

I also had the same problem and here is how I fixed it:

Don’t enable Hyper-V Dynamic Memory for your virtual machine but set it static with a value of e.g. 8GB RAM

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.