45
46 failures=0
47
48 go() {
49 echo ''
50 sh -xc "$JAVA $TESTVMOPTS $*" 2>&1
51 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
52 }
53
54 # Run test with each GC configuration
55 #
56 # Notes: To ensure that metaspace fills up we disable class unloading.
57 # Also we set the max metaspace to 16MB/32MB - otherwise the test takes too
58 # long to run. The 32MB setting is required for running with CDS archive.
59
60 go -noclassgc -XX:MaxMetaspaceSize=32m -XX:+UseSerialGC LowMemoryTest2
61 go -noclassgc -XX:MaxMetaspaceSize=32m -XX:+UseParallelGC LowMemoryTest2
62
63 # Test class metaspace - might hit MaxMetaspaceSize instead if
64 # UseCompressedClassPointers is off or if 32 bit.
65 go -noclassgc -XX:MaxMetaspaceSize=16m -XX:CompressedClassSpaceSize=4m LowMemoryTest2
66
67 echo ''
68 if [ $failures -gt 0 ];
69 then echo "$failures test(s) failed";
70 else echo "All test(s) passed"; fi
71 exit $failures
|
45
46 failures=0
47
48 go() {
49 echo ''
50 sh -xc "$JAVA $TESTVMOPTS $*" 2>&1
51 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
52 }
53
54 # Run test with each GC configuration
55 #
56 # Notes: To ensure that metaspace fills up we disable class unloading.
57 # Also we set the max metaspace to 16MB/32MB - otherwise the test takes too
58 # long to run. The 32MB setting is required for running with CDS archive.
59
60 go -noclassgc -XX:MaxMetaspaceSize=32m -XX:+UseSerialGC LowMemoryTest2
61 go -noclassgc -XX:MaxMetaspaceSize=32m -XX:+UseParallelGC LowMemoryTest2
62
63 # Test class metaspace - might hit MaxMetaspaceSize instead if
64 # UseCompressedClassPointers is off or if 32 bit.
65 #
66 # (note: This is very shaky and that shakiness exposes a problem with MemoryMXBean:
67 #
68 # MemoryMXBean defines "used" "committed" and "max" (see java/lang/management/MemoryUsage.java)
69 # This abstraction misses a definition for "address space exhausted" which with the new Metaspace (jep387)
70 # can happen before committed/used hits any trigger. We now commit only on demand and therefore class loaders
71 # can sit atop of uncommitted address space, denying new loaders address space. In the old Metaspace,
72 # we would have committed the space right away and therefore the MemoryMXBean "committed" trigger
73 # would have fired. In the new Metaspace, we don't commit, so the MemoryMXBean does not fire.
74 go -noclassgc -XX:MaxMetaspaceSize=16m -XX:CompressedClassSpaceSize=4m LowMemoryTest2
75
76 echo ''
77 if [ $failures -gt 0 ];
78 then echo "$failures test(s) failed";
79 else echo "All test(s) passed"; fi
80 exit $failures
|