开发者

Memory pressure notification in SQL CLR

开发者 https://www.devze.com 2022-12-22 03:18 出处:网络
Google is not able to tell开发者_StackOverflow社区 me if there is an API available inside the SQL CLR to get memory pressure notification.

Google is not able to tell开发者_StackOverflow社区 me if there is an API available inside the SQL CLR to get memory pressure notification.

It is obviously used, since the AppDomain will get unloaded under memory pressure, but the question is if the notification is sent to into the AppDomain prior to the unload, so that I could release some cache memory.

(My dll is already running in unsafe mode, so that is a non-issue)


In SQL 2012, they implemented a new query that allows you to get the current memory usage...

select survived_memory_kb from sys.dm_clr_appdomains where db_id = DB_ID()

It doesn't give you the memory pressure, but it does allow you to monitor the usage of memory, and thus adjust based on your own logic.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号