• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-Nov-2021-

GC.javaH A D03-Nov-20219.8 KiB290194

GCTokens.javaH A D03-Nov-20211.8 KiB4212

ObjectGraph.javaH A D03-Nov-20215.4 KiB15076

READMEH A D03-Nov-20213.6 KiB6754

ReferenceInfo.javaH A D03-Nov-20212.7 KiB6324

TestObjectGraphAfterGC.javaH A D03-Nov-202112 KiB256100

TestcaseData.javaH A D03-Nov-20216.9 KiB207140

README

1/*
2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25The test checks that after different type of GC unreachable objects behave as expected:
26
271. Young GC - weakly referenced non-humongous objects are collected, other objects are not collected.
28
292. Full GC - weakly referenced non-humongous and humongous objects are collected, softly referenced non-humongous and
30             humongous objects are not collected.
31
323. Full GC with memory pressure - weakly and softly referenced non-humongous and humongous objects are collected.
33
344. CMC -  weakly referenced non-humongous objects are collected, other objects are not collected since weak references
35          from Young Gen is handled as strong during CMC.
36
375. CMC_NO_SURV_ROOTS -  weakly referenced non-humongous and humongous objects are collected, softly referenced
38                        non-humongous and humongous objects are not collected since we make 2 Young GC to promote all
39                        weak references to Old Gen.
40
416. Mixed GC - weakly referenced non-humongous and humongous objects are collected, softly referenced non-humongous and
42              humongous objects are not collected.
43
44The test gets gc type as a command line argument.
45Then the test allocates object graph in heap (currently testing scenarios are pre-generated and stored in
46TestcaseData.getPregeneratedTestcases()) with TestObjectGraphAfterGC::allocateObjectGraph.
47
48Since we are testing humongous objects we need pretty unusual nodes - arrays of Object.
49We need this since only large enough array could be Humongous object (in fact class with huge amount of fields is
50humongous too but it's for other tests).
51ObjectGraph class generates object graph with Object[] nodes. It also provides a way to collect
52information about each node using "visitor" pattern.
53
54Using visitors we build Set of ReferenceInfo instances which contains the following information:
55reference - external weak/soft reference to graph's node
56graphId and nodeId - graph's and node's ids - we need this for error handling
57softlyReachable - is node effectively referenced by external soft reference. It could be when external
58soft reference or when this node is reachable from node that exteranally referenced by soft reference
59effectiveHumongous - if node behaves effectively humongous.  It could be when node is humongous
60or when this node is reachable from humongous node.
61
62When we leave TestObjectGraphAfterGC::allocateObjectGraph we make graph reachable only with references from Set of
63ReferenceInfo instances.
64
65We run specified gc and check that each instance of ReferenceInfo set behaves as expected.
66Then we check that gc log file contains expected tokens and doesn't contain tokens that it should not contain.
67