comparison src/share/vm/prims/jvmtiEnv.cpp @ 4731:4ceaf61479fc

7122253: Instrumentation.retransformClasses() leaks class bytes Summary: Change ClassFileParser::parseClassFile() to use the instanceKlass:_cached_class_file_bytes field to avoid leaking the cache. Reviewed-by: coleenp, acorn, poonam
author dcubed
date Thu, 22 Dec 2011 12:50:42 -0800
parents a6eef545f1a2
children 0ebca2e35ca5 d2a62e0f25eb
comparison
equal deleted inserted replaced
4719:d532160c55f7 4731:4ceaf61479fc
265 return JVMTI_ERROR_UNMODIFIABLE_CLASS; 265 return JVMTI_ERROR_UNMODIFIABLE_CLASS;
266 } 266 }
267 267
268 instanceKlassHandle ikh(current_thread, k_oop); 268 instanceKlassHandle ikh(current_thread, k_oop);
269 if (ikh->get_cached_class_file_bytes() == NULL) { 269 if (ikh->get_cached_class_file_bytes() == NULL) {
270 // not cached, we need to reconstitute the class file from VM representation 270 // Not cached, we need to reconstitute the class file from the
271 // VM representation. We don't attach the reconstituted class
272 // bytes to the instanceKlass here because they have not been
273 // validated and we're not at a safepoint.
271 constantPoolHandle constants(current_thread, ikh->constants()); 274 constantPoolHandle constants(current_thread, ikh->constants());
272 ObjectLocker ol(constants, current_thread); // lock constant pool while we query it 275 ObjectLocker ol(constants, current_thread); // lock constant pool while we query it
273 276
274 JvmtiClassFileReconstituter reconstituter(ikh); 277 JvmtiClassFileReconstituter reconstituter(ikh);
275 if (reconstituter.get_error() != JVMTI_ERROR_NONE) { 278 if (reconstituter.get_error() != JVMTI_ERROR_NONE) {