Daniel D. Daugherty
daniel.daugherty at oracle.com
Fri Aug 12 12:23:55 PDT 2011
On 8/12/11 1:08 PM, suraj puvvada wrote:
> "I use RedefineClasses() API extensively. Wanted to know what is the
> impact redefining a class has on Perm Gen ? Are the older versions of
> a redefined class retained in memory forever ?"
> If there is a more appropriate forum to post appreciate if you can let
> me know.
You've found the right forum.
Short answer: older versions of redefined methods are only kept
around as long as a thread is executing that method.
Longer answer: When RedefineClasses() replaces a target class, it
keeps weak references to various parts (methods and the constant
pool come to mind) of the original class for internal book keeping
reasons. As threads finish executing the obsolete or old methods,
they become GC'able. That doesn't mean they are GC'ed right away,
but they will be eventually.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the serviceability-dev