[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-serviceability-dev
Subject: Re: RFR(XS) 6625574: MemoryMXBean/Pending.java fails: "pending finalization = 0 but expected > 0"
From: Mattias Tobiasson <mattias.tobiasson () oracle ! com>
Date: 2014-03-03 11:51:32
Message-ID: fe387641-d8aa-40dd-be29-7bac2774cb37 () default
[Download RAW message or body]
Staffan, could you please sponsor this fix?
Thanks,
Mattias
----- Original Message -----
From: staffan.larsen@oracle.com
To: mattias.tobiasson@oracle.com
Cc: serviceability-dev@openjdk.java.net
Sent: Friday, February 28, 2014 1:58:44 PM GMT +01:00 Amsterdam / Berlin / Bern / \
Rome / Stockholm / Vienna
Subject: Re: RFR(XS) 6625574: MemoryMXBean/Pending.java fails: "pending finalization \
= 0 but expected > 0"
Looks good!
Thanks,
/Staffan
On 28 feb 2014, at 13:56, Mattias Tobiasson <mattias.tobiasson@oracle.com> wrote:
> Hi,
> Could you please review this fix?
>
> The test often fails when run with command line "-Xcomp"
>
> The test creates some objects and stores them in a local variable in the function. \
> The test expects those objects to survive until they are set to null. The problem \
> seems to be that the optimizer realizes that the objects are never used and removes \
> them before the test expects it.
> The solution is to move the local variable out to a public static variable. Then \
> the optimizer will not remove it before expected.
> webrev:
> http://cr.openjdk.java.net/~mtobiass/6625574/webrev.00
>
> bug:
> https://bugs.openjdk.java.net/browse/JDK-6625574
>
> Mattias
["6625574.patch" (text/x-patch)]
# HG changeset patch
# User mtobiass
# Date 1393591131 -3600
# Node ID 511f475aa2c8dbad0f636851fc8c2a032f1d64db
# Parent 0731952efb104b783b75a5765a91a91601903a3c
6625574: java/lang/management/MemoryMXBean/Pending.java fails: "pending finalization \
= 0 but expected > 0"
Summary: Move local objs variable to a static public so the the optimizer will not \
remove it unexpectedly.
diff --git a/test/java/lang/management/MemoryMXBean/Pending.java \
b/test/java/lang/management/MemoryMXBean/Pending.java
--- a/test/java/lang/management/MemoryMXBean/Pending.java
+++ b/test/java/lang/management/MemoryMXBean/Pending.java
@@ -76,6 +76,9 @@
System.out.println("Test passed.");
}
+ // Keep objs public so the optimizer will not remove them too early.
+ public static Object[] objs = null;
+
private static void test() throws Exception {
// Clean the memory and remove all objects that are pending
// finalization
@@ -105,7 +108,7 @@
System.out.println(" Afer creating objects with no ref: " + snapshot);
printFinalizerInstanceCount();
- Object[] objs = new Object[REF_COUNT];
+ objs = new Object[REF_COUNT];
for (int i = 0; i < REF_COUNT; i++) {
objs[i] = new MyObject();
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic