[jboss-user] [Javassist user questions] - Strategy for classpool = null clearing

PaulKeeble do-not-reply at jboss.com
Sat Jul 4 22:13:09 EDT 2009


In the tutorial one of the noted problems is the memory usage climb with creating a lot of CtClass's etc that are all stored in the ClassPool. I am having trouble combining that advice with a javaagent implementation.

The problem is really the order you see classes in and knowing when its safe to clear the pool. For instance say I have the following two classes:


  | class Account {
  | ...
  | }
  | 
  | Class SavingsAccount extends Account {
  | ...
  | }
  | 

The javaagent will receive first the Account class, followed by the SavingsAccount. If you clear the pool after the Account class then SavingsAccount will see an a non enhanced class (which I can't do as I am adding constructors which the subclass will call).

So the question is really what is the usual approach to this? So far I have tried the following:

- Clearing every X times called, fails for obvious reasons
- Clearing at the beginning of the program, fails because not all classes are necessarily loaded at that point

I need something that some how mind reads the future calls! Any ideas?

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4241820#4241820

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4241820



More information about the jboss-user mailing list