Skip to content

Commit 095f62e

Browse files
[GR-60079] JFR leak profiler fixes.
PullRequest: graal/19422
2 parents 9fbd75d + 2a31c18 commit 095f62e

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jfr/oldobject/JfrOldObject.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2023, 2023, Red Hat Inc. All rights reserved.
2+
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2023, 2024, Red Hat Inc. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -61,9 +61,9 @@ public final class JfrOldObject implements UninterruptibleComparable, Uninterrup
6161

6262
@SuppressWarnings("hiding")
6363
@Uninterruptible(reason = CALLED_FROM_UNINTERRUPTIBLE_CODE, mayBeInlined = true)
64-
void initialize(Object obj, UnsignedWord allocatedSize, long threadId, long stackTraceId, UnsignedWord heapUsedAfterLastGC, int arrayLength) {
64+
void initialize(Object obj, UnsignedWord span, UnsignedWord allocatedSize, long threadId, long stackTraceId, UnsignedWord heapUsedAfterLastGC, int arrayLength) {
6565
ReferenceInternals.setReferent(reference, obj);
66-
this.span = allocatedSize;
66+
this.span = span;
6767
this.objectSize = allocatedSize;
6868
this.allocationTicks = JfrTicks.elapsedTicks();
6969
this.threadId = threadId;

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jfr/oldobject/JfrOldObjectSampler.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2023, 2023, Red Hat Inc. All rights reserved.
2+
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2023, 2024, Red Hat Inc. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -89,7 +89,7 @@ boolean sample(Object obj, UnsignedWord allocatedSize, int arrayLength) {
8989
}
9090
}
9191

92-
store(obj, allocatedSize, arrayLength);
92+
store(obj, span, allocatedSize, arrayLength);
9393
return true;
9494
}
9595

@@ -142,17 +142,17 @@ private void release(JfrOldObject sample) {
142142
}
143143

144144
@Uninterruptible(reason = CALLED_FROM_UNINTERRUPTIBLE_CODE, mayBeInlined = true)
145-
private void store(Object obj, UnsignedWord allocatedSize, int arrayLength) {
145+
private void store(Object obj, UnsignedWord span, UnsignedWord allocatedSize, int arrayLength) {
146146
Thread thread = JavaThreads.getCurrentThreadOrNull();
147147
long threadId = thread == null ? 0L : JavaThreads.getThreadId(thread);
148148
long stackTraceId = thread == null ? 0L : SubstrateJVM.get().getStackTraceId(JfrEvent.OldObjectSample, 0);
149149
UnsignedWord heapUsedAfterLastGC = Heap.getHeap().getUsedMemoryAfterLastGC();
150150

151151
JfrOldObject sample = (JfrOldObject) freeList.pop();
152-
sample.initialize(obj, allocatedSize, threadId, stackTraceId, heapUsedAfterLastGC, arrayLength);
152+
sample.initialize(obj, span, allocatedSize, threadId, stackTraceId, heapUsedAfterLastGC, arrayLength);
153153
queue.add(sample);
154154
usedList.append(sample);
155-
totalInQueue.add(allocatedSize);
155+
totalInQueue = totalInQueue.add(span);
156156
}
157157

158158
@Uninterruptible(reason = CALLED_FROM_UNINTERRUPTIBLE_CODE, mayBeInlined = true)

0 commit comments

Comments
 (0)