author | dl |
Mon, 12 Sep 2016 13:14:49 -0700 | |
changeset 40817 | 4f5fb115676d |
parent 40279 | 7a1e94e544d6 |
child 42338 | a60f280f803c |
permissions | -rw-r--r-- |
2 | 1 |
/* |
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
3 |
* |
|
4 |
* This code is free software; you can redistribute it and/or modify it |
|
5 |
* under the terms of the GNU General Public License version 2 only, as |
|
6 |
* published by the Free Software Foundation. |
|
7 |
* |
|
8 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
9 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
10 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
11 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
12 |
* accompanied this code). |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License version |
|
15 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
16 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
17 |
* |
|
5506 | 18 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
19 |
* or visit www.oracle.com if you need additional information or have any |
|
20 |
* questions. |
|
2 | 21 |
*/ |
22 |
||
23 |
/* |
|
24 |
* This file is available under and governed by the GNU General Public |
|
25 |
* License version 2 only, as published by the Free Software Foundation. |
|
26 |
* However, the following notice accompanied the original version of this |
|
27 |
* file: |
|
28 |
* |
|
40279
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
29 |
* Written by Doug Lea and Martin Buchholz with assistance from |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
30 |
* members of JCP JSR-166 Expert Group and released to the public |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
31 |
* domain, as explained at |
9242
ef138d47df58
7034657: Update Creative Commons license URL in legal notices
dl
parents:
5506
diff
changeset
|
32 |
* http://creativecommons.org/publicdomain/zero/1.0/ |
2 | 33 |
*/ |
34 |
||
35 |
/* |
|
36 |
* @test |
|
37 |
* @bug 6236036 6264015 |
|
40279
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
38 |
* @summary Checks for a memory leak when a sequence of aborted timed |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
39 |
* waits occur without a signal. Uses the strategy of detecting |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
40 |
* changes in the size of the object graph retained by a root object. |
2 | 41 |
*/ |
42 |
||
40279
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
43 |
import java.lang.reflect.AccessibleObject; |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
44 |
import java.lang.reflect.Array; |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
45 |
import java.lang.reflect.Field; |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
46 |
import java.lang.reflect.Modifier; |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
47 |
import java.util.ArrayDeque; |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
48 |
import java.util.Collection; |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
49 |
import java.util.Collections; |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
50 |
import java.util.IdentityHashMap; |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
51 |
import java.util.Set; |
34347 | 52 |
import java.util.concurrent.ArrayBlockingQueue; |
53 |
import java.util.concurrent.BlockingQueue; |
|
40279
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
54 |
import java.util.concurrent.ConcurrentHashMap; |
39781
8190c004acbd
8161591: Miscellaneous changes imported from jsr166 CVS 2016-07
dl
parents:
34347
diff
changeset
|
55 |
import java.util.concurrent.LinkedBlockingDeque; |
34347 | 56 |
import java.util.concurrent.LinkedBlockingQueue; |
57 |
import java.util.concurrent.LinkedTransferQueue; |
|
40279
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
58 |
import java.util.concurrent.PriorityBlockingQueue; |
34347 | 59 |
import java.util.concurrent.SynchronousQueue; |
60 |
import java.util.concurrent.TimeUnit; |
|
2 | 61 |
|
62 |
public class PollMemoryLeak { |
|
40279
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
63 |
public static void main(String[] args) throws Throwable { |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
64 |
new PollMemoryLeak().main(); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
65 |
} |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
66 |
|
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
67 |
void main() throws Throwable { |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
68 |
test(new LinkedBlockingDeque(10)); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
69 |
test(new LinkedBlockingQueue(10)); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
70 |
test(new LinkedTransferQueue()); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
71 |
test(new ArrayBlockingQueue(10)); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
72 |
test(new PriorityBlockingQueue()); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
73 |
test(new SynchronousQueue()); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
74 |
test(new SynchronousQueue(true)); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
75 |
} |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
76 |
|
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
77 |
void test(BlockingQueue q) throws Throwable { |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
78 |
assertNoLeak(q, () -> timedPoll(q)); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
79 |
|
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
80 |
// A demo that the leak detection infrastructure works |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
81 |
// assertNoLeak(q, () -> q.add(1)); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
82 |
// printRetainedObjects(q); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
83 |
} |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
84 |
|
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
85 |
static void timedPoll(BlockingQueue q) { |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
86 |
try { q.poll(1, TimeUnit.NANOSECONDS); } |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
87 |
catch (InterruptedException ex) { throw new AssertionError(ex); } |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
88 |
} |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
89 |
|
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
90 |
// -------- leak detection infrastructure --------------- |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
91 |
void assertNoLeak(Object root, Runnable r) { |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
92 |
int prev = retainedObjects(root).size(); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
93 |
for (int i = 0; i < 3; i++) { |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
94 |
for (int j = 0; j < 3; j++) r.run(); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
95 |
int next = retainedObjects(root).size(); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
96 |
if (next <= prev) |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
97 |
return; |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
98 |
prev = next; |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
99 |
} |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
100 |
throw new AssertionError( |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
101 |
String.format("probable memory leak in %s: %s", |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
102 |
root.getClass().getSimpleName(), root)); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
103 |
} |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
104 |
|
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
105 |
ConcurrentHashMap<Class<?>, Collection<Field>> classFields |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
106 |
= new ConcurrentHashMap<Class<?>, Collection<Field>>(); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
107 |
|
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
108 |
Collection<Field> referenceFieldsOf(Class<?> k) { |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
109 |
Collection<Field> fields = classFields.get(k); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
110 |
if (fields == null) { |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
111 |
fields = new ArrayDeque<Field>(); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
112 |
ArrayDeque<Field> allFields = new ArrayDeque<Field>(); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
113 |
for (Class<?> c = k; c != null; c = c.getSuperclass()) |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
114 |
for (Field field : c.getDeclaredFields()) |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
115 |
if (!Modifier.isStatic(field.getModifiers()) |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
116 |
&& !field.getType().isPrimitive()) |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
117 |
fields.add(field); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
118 |
AccessibleObject.setAccessible( |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
119 |
fields.toArray(new AccessibleObject[0]), true); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
120 |
classFields.put(k, fields); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
121 |
} |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
122 |
return fields; |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
123 |
} |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
124 |
|
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
125 |
static Object get(Field field, Object x) { |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
126 |
try { return field.get(x); } |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
127 |
catch (IllegalAccessException ex) { throw new AssertionError(ex); } |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
128 |
} |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
129 |
|
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
130 |
Set<Object> retainedObjects(Object x) { |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
131 |
ArrayDeque<Object> todo = new ArrayDeque<Object>() { |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
132 |
public void push(Object x) { if (x != null) super.push(x); }}; |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
133 |
Set<Object> uniqueObjects = Collections.newSetFromMap( |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
134 |
new IdentityHashMap<Object, Boolean>()); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
135 |
todo.push(x); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
136 |
while (!todo.isEmpty()) { |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
137 |
Object y = todo.pop(); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
138 |
if (uniqueObjects.contains(y)) |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
139 |
continue; |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
140 |
uniqueObjects.add(y); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
141 |
Class<?> k = y.getClass(); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
142 |
if (k.isArray() && !k.getComponentType().isPrimitive()) { |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
143 |
for (int i = 0, len = Array.getLength(y); i < len; i++) |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
144 |
todo.push(Array.get(y, i)); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
145 |
} else { |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
146 |
for (Field field : referenceFieldsOf(k)) |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
147 |
todo.push(get(field, y)); |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
148 |
} |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
149 |
} |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
150 |
return uniqueObjects; |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
151 |
} |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
152 |
|
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
153 |
/** for debugging the retained object graph */ |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
154 |
void printRetainedObjects(Object x) { |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
155 |
for (Object y : retainedObjects(x)) |
7a1e94e544d6
8151158: [TESTBUG] java/util/concurrent/forkjoin/FJExceptionTableLeak.java fails due to out of memory
dl
parents:
39781
diff
changeset
|
156 |
System.out.printf("%s : %s%n", y.getClass().getSimpleName(), y); |
2 | 157 |
} |
158 |
} |