Integrated: JDK-8273902: Memory leak in OopStorage due to bug in OopHandle::release()
Volker Simonis
simonis at openjdk.java.net
Thu Sep 16 19:59:50 UTC 2021
On Thu, 16 Sep 2021 16:08:39 GMT, Volker Simonis <simonis at openjdk.org> wrote:
> Currently, `OopHandle::release()` is implemented as follows:
>
> inline void OopHandle::release(OopStorage* storage) {
> if (peek() != NULL) {
> // Clear the OopHandle first
> NativeAccess<>::oop_store(_obj, (oop)NULL);
> storage->release(_obj);
> }
> }
>
> However, peek() returns NULL not only if the oop* `_obj` is NULL, but also when `_obj` points to a zero oop. In the latter case, the oop* `_obj` will not be released from the corresponding OopStorage and the slot it occupies will remain alive forever.
>
> This behavior can be easily triggered with the `LeakTestMinimal.java` test which is attached to the [JBS issue](https://bugs.openjdk.java.net/browse/JDK-8273902)(thanks to Oli Gillespie from the Amazon Profiler team for detecting the issue and providing a reproducer).
>
> This fix should probably also be downported to jdk17 as quickly as possible.
This pull request has now been integrated.
Changeset: bc48a0ac
Author: Volker Simonis <simonis at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/bc48a0ac297b99a997482dcb59f85acc1cdb0c47
Stats: 4 lines in 2 files changed: 0 ins; 2 del; 2 mod
8273902: Memory leak in OopStorage due to bug in OopHandle::release()
Reviewed-by: sspitsyn, coleenp
-------------
PR: https://git.openjdk.java.net/jdk/pull/5549
More information about the serviceability-dev
mailing list