EVALUATION
Fixed 6306746: Add assertions to GrowableArray and ResourceObj
Fixed 6306730: Incorrect management of C-heap GrowableArrays (gc)
Fixed 6306736: Incorrect management of C-heap (jvmti)
Fixed 6306741: Memory leaks of C-heap allocated ResourceObjs (gc)
Fixed 6306743: Memory leaks of C-heap allocated ResourceObjs (jvmti)
Fixed 6306745: Memory leaks of C-heap allocated ResourceObjs (runtime)
Fixed 6306738: Memory leaks of C-heap allocated ResourceObjs (c2)
Require GrowableArrays whose elements are allocated on the C heap to also
be allocated on the C heap. This prevents leaking the GrowableArray object
itself or worse, having it go out of scope of it's containing ResourceMark.
Which is usually why C_heap was used for the arguments themselves.
I added a field to ResourceObj to track whether new allocates on c_heap,
resource area, or arena, and implemented the ResourceObj::operator delete
to call FreeHeap() if the allocation was on C heap. An assert was added
to the delete() operator to check that delete can only be called on a
C_HEAP allocated object, because it's not needed for resource and arena
allocated objects.
Also, added a GrowableArray destructor to call clear_and_deallocate() so that
all callers need to do is:
GrowableArray<T> *ga = new (C_HEAP) GrowableArray<T>(,true);
...
delete ga; // call dtor and ResourceObj::operator delete()
Also I removed NonPrintingResourceObj because it's supposedly an optimization
of ResourceObj. In PRODUCT mode, the virtual print() functions aren't
included anyway, so I didn't get the reason for the optimization. Timed
runThese -full with fastdebug and it came out about the same, actually it
came out faster(?).
Also, fixed compilation warning from tagged stack interpreter putback.
Fix verified: y
Verified by: Fixed asserts that were found with instances of Resource
allocated growable arrays with C_heap elements.
PRT
Other testing: nsk vm.nightly.testlist (derived from vm.quick.testlist)
(include jvmti tests) with -client/-server
runThese -full -client/-server
Initial version reviewed by: Steve B, Alan B, Ken, Mandy, Ramki, John R
Final version
Reviewed by: Steve B, John C, Steve G, Vladimir, Alan B
|