From 73969fa11a7ed8a4b62919d54f2e44d90812d029 Mon Sep 17 00:00:00 2001 From: chiba Date: Fri, 8 Jun 2007 13:32:10 +0000 Subject: made automatic pruning off by default because I found that pruning does not really save memory (only 20%). I changed Javassist to compress a class file on memory after toBytecode(). git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@383 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- tutorial/tutorial.html | 58 ++++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 25 deletions(-) (limited to 'tutorial') diff --git a/tutorial/tutorial.html b/tutorial/tutorial.html index 097d695a..b6876d4c 100644 --- a/tutorial/tutorial.html +++ b/tutorial/tutorial.html @@ -140,19 +140,37 @@ not permitted. This is for warning the developers when they attempt to modify a class file that has been already loaded since the JVM does not allow reloading a class. -

When Javassist freezes a CtClass object, it also -prunes the data structure contained in that object. To reduce memory -consumption, Javassist discards unnecessary attributes +

A frozen CtClass can be defrost so that +modifications of the class definition will be permitted. For example, + +

+ +

After defrost() is called, the CtClass +object can be modified again. + +

If ClassPool.doPruning is set to true, +then Javassist prunes the data structure contained +in a CtClass object +when Javassist freezes that object. +To reduce memory +consumption, pruning discards unnecessary attributes (attribute_info structures) in that object. For example, Code_attribute structures (method bodies) are discarded. Thus, after a CtClass object is pruned, the bytecode of a method is not -accessible although method names, signatures, and annotations -are still accessible. +accessible except method names, signatures, and annotations. +The pruned CtClass object cannot be defrost again. +The default value of ClassPool.doPruning is false. -

To disallow pruning a CtClass, stopPruning() -must be called in advance: +

To disallow pruning a particular CtClass, +stopPruning() must be called on that object in advance:

-

If a CtClass is not pruned, it can be defrost so that -modifications of the class definition can be permitted. For example, - -

- -

To disallow pruning for all the CtClasses, set -ClassPool.doPruning to false. +

The CtClass object cc is not pruned. +Thus it can be defrost after writeFile() is called.

+

Class search path

The default ClassPool returned -- cgit v1.2.3