The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
Deoptimization code of JIT compiler in JVM 1.5 seems to be leaking memory under some situation.
Comments
EVALUATION
When lazy deopt was added and the vframeArray code was rewritten this leak was introduced.
After going through the C2 code, found that these get deallocated in unpack_on_stack() which calls deallocate_monitor_chunks().
void vframeArray::deallocate_monitor_chunks() {
JavaThread* jt = JavaThread::current();
for (int index = 0; index < frames(); index++ ) {
MonitorChunk* chunk = element(index)->monitors();
if (chunk != NULL) {
jt->remove_monitor_chunk(chunk);
}
}
}
void JavaThread::remove_monitor_chunk(MonitorChunk* chunk) {
guarantee(monitor_chunks() != NULL, "must be non empty");
if (monitor_chunks() == chunk) {
set_monitor_chunks(chunk->next());
} else {
MonitorChunk* prev = monitor_chunks();
while (prev->next() != chunk) prev = prev->next();
prev->set_next(chunk->next());
}
}
In remove_monitor_chunk, we just set the pointer of the list to next chunk and don't actually delete the passed chunk.
Thanks to Poonam for finding this.