Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
8284549: JFR: FieldTable leaks FieldInfoTable member
Backport-of: 92f5e42696847de7e47e238412d2d541a11bccd7
  • Loading branch information
Ekaterina Vergizova committed Jul 28, 2022
1 parent 8fcba34 commit 8c54455
Showing 1 changed file with 16 additions and 6 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -612,11 +612,11 @@ ObjectSampleWriter::ObjectSampleWriter(JfrCheckpointWriter& writer, EdgeStore* s
assert(store != NULL, "invariant");
assert(!store->is_empty(), "invariant");
register_serializers();
sample_infos = NULL;
ref_infos = NULL;
array_infos = NULL;
field_infos = NULL;
root_infos = NULL;
assert(field_infos == NULL, "Invariant");
assert(sample_infos == NULL, "Invariant");
assert(ref_infos == NULL, "Invariant");
assert(array_infos == NULL, "Invariant");
assert(root_infos == NULL, "Invariant");
}

ObjectSampleWriter::~ObjectSampleWriter() {
Expand All @@ -625,6 +625,16 @@ ObjectSampleWriter::~ObjectSampleWriter() {
write_array_infos(_writer);
write_field_infos(_writer);
write_root_descriptors(_writer);

// Followings are RA allocated, memory will be released automatically.
if (field_infos != NULL) {
field_infos->~FieldTable();
field_infos = NULL;
}
sample_infos = NULL;
ref_infos = NULL;
array_infos = NULL;
root_infos = NULL;
}

bool ObjectSampleWriter::operator()(StoredEdge& e) {
Expand Down

1 comment on commit 8c54455

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.