[Mono-dev] What would you like to see in Mono?

Tomi Valkeinen tomba at bat.org
Wed Mar 29 09:32:15 EST 2006


On Wed, 29 Mar 2006, Jonathan Pryor wrote:

> Given all the interdependencies between JITed code, executing code, and
> call stacks, unloading types is a difficult proposition, which is
> probably why an AppDomain unload is the only way to do that under .NET.

Yes, that's probably the reason. Still, I believe that types could be 
unloaded, and everything would work fine if I just wouldn't use those 
unloaded types afterwards. Sure it's dangerous and unsafe, but it could 
work if restricted to a small piece of code in the core of the framework 
you are coding.

> So what's wrong with AppDomains?  If they're too slow, perhaps we should
> improve cross-AppDomain invocation.  If they're buggy, they should be
> fixed.

The speed is the main reason, and I guess memory usage is also an issue. 
AppDomains work fine for plugin-style cases, where you can group lots of 
types together, and cross-domain calls are not the majority, but if I 
would put each and every type in its own AppDomain... You may wonder where 
I need that kind of functionality, and the case I was thinking about is a 
MUD (multi user dungeon). BatMUD has currently 20171 loaded programs, ie. 
types, which can be recompiled on the fly. That's quite a lot of 
AppDomains.

A couple of years ago I made some performance testing with AppDomains on 
MS's CLR and compared the results to ldmud, which is a MUD driver. I don't 
have the results here, nor do I exactly remember them, but AppDomains were 
not ten or hundred times slower, but more like a million times. The .Net 
version probably was 1.1, and AppDomains have improved since then, but I 
guess they are still far behind the performance I'm looking for. (yes, 
yes, I should redo the test =).

  Tomi



More information about the Mono-devel-list mailing list