Empirical numbers of anonymous classes versus regular classes?

Charles Oliver Nutter charles.nutter at sun.com
Sat Sep 6 17:12:03 PDT 2008


Anyone done any comparison of memory use between using anonymous classes 
(both completely new and const-pool-patched-only) and generating regular 
classes, wrt memory consumption? I have more use cases for anonymous 
classes in JRuby than I can count, including a number which are wholly 
suitable for const-pool patching. My initial experiments with anonymous 
classes just used them as a better, less-binding classloader where I 
still generated the same code. But I'm about to test out a modified 
version of my method handle generator that uses anonymous class patching 
to use a couple classes as templates and just patch for the others.

I assume part of the design of anonymous classloading was so that the 
bulk of the class data can be shared between the original class and the 
patched class. What sort of memory savings does that add up to? Bigtime 
permgen reduction?

- Charlie



More information about the mlvm-dev mailing list