On Mon, 25 Oct 2021 22:17:33 GMT, Coleen Phillimore <cole...@openjdk.org> wrote:
>> // Can't release the constant pool here because the constant pool can be >> // deallocated separately from the InstanceKlass for default methods and >> // redefine classes. >> >> Because of this comment. We have two ways that we can get to >> ConstantPool::deallocate_contents. We don't have two ways to get to the >> Method::deallocate_contents. >> >> The deallocate list contains unloaded/unattached Methods (from the relocator >> for jsr/ret), scratch classes from redefinition, fully formed constant pools >> from default methods, or fully formed InstanceKlass from classfile parsing >> errors or class definition errors. >> >> Only the constant pool case should be separated out in deallocate_contents, >> which is why it's excluded. > > Is the suggestion to have a default parameter to free CHEAP structures that's > false for deallocate_contents? > I'm not really sure it's an improvement because I have to have an extra > parameter to Klass::release_C_heap_structures that's unused. That is one option but I was thinking perhaps remove `constants()->release_C_heap_structures()` from `instanceKlass::release_C_heap_structures()` and have the callers that should remove the CP call `ik->constants()->release_C_heap_structures()` directly? Or perhaps just change this comment: // Release C heap allocated data that this points to, which includes // reference counting symbol names. release_C_heap_structures_internal(); to ` // reference counting symbol names, but excludes the constant pool.` ------------- PR: https://git.openjdk.java.net/jdk/pull/6105