问题
Since dynamic assembly loading requires appdomain loading to enable killing the assembly with unloading related appdomain, is there a "max" number appdomains in a process to be loaded? I am thinking of a server based application that each user can run his proprietary C# code dynamically. But what if, say, 2000 users log in and load their codes? Are there any possible restrictions I might encounter besides the number of appdomians?
thanks.
回答1:
Almost all CLR limits are based on "as memory permits". The only exception I know of is the number of members of a class, restricted to 65536. That's based on the definition of a token value. Nothing like that for AppDomains.
回答2:
I don't believe that there is a definitive maximum value in-built in the CLR. Rather it would be the amount of memory left which determines if you can dynamically load a new appdomain.
I'll do a bit of research, but I don't think there is a value set for this.
EDIT:
Here's another post which might help clear things up.
回答3:
Mostly it would be defined by your OS limits. Your x86 machine can't use more than 4GB in memory for a process [only 2GB in user mode]. If you go for x64 you have a much bigger limit. From what I know there is no such limit to the number of Application Domains you can create.
来源:https://stackoverflow.com/questions/4135756/max-number-of-appdomains-loaded-in-one-process