Question

I'm trying to programmatically restrict the memory consumption of plugins running in a .Net AppDomain, but I can't find any setup parameters for this, nor can I find a way to query an AppDomain to figure out how much memory it is consuming. Any ideas?

Was it helpful?

Solution

Here's the documentation for querying a process's memory usage. Not the same as the AppDomain, but it might be a place to start.

http://msdn.microsoft.com/en-us/library/s80a75e5(VS.80).aspx

You can ask the GC what it thinks is currently allocated also.

http://msdn.microsoft.com/en-us/library/system.gc.gettotalmemory(VS.71).aspx

OTHER TIPS

Old question, but in the meantime (since .Net framework 4.0) a new solution is available. You will have to enable ARM (Application domain Resource Monitoring). From that point on, you can request information on total consumed processor time, memory usage etc.

See Microsoft documentation over here

Not sure programatically, but Process Explorer can tell you how much memory a .net AppDomain is using. Maybe they have some documentation out there about how they are querying that info.

Using the mscoree.CorRuntimeHostClass interop from C:\WINDOWS\Microsoft.NET\Framework\vXXXXXX\mscoree.tlb

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top