OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 // Deliberately fragment the heap and test that GC peformance does not |
| 6 // break down. See https://github.com/dart-lang/sdk/issues/29588 |
| 7 // Normally runs in about 6-7 seconds on an x64 machine, using about 2.5Gbytes |
| 8 // of memory. |
| 9 // |
| 10 // This test is deliberately CPU-light and so it can make a lot of |
| 11 // progress before the concurrent sweepers are done sweeping the heap. |
| 12 // In that time there is no freelist and so the issue does not arise. |
| 13 // VMOptions=--no-concurrent-sweep |
| 14 |
| 15 main() { |
| 16 final List<List> arrays = []; |
| 17 // Fill up heap with alternate large-small items. |
| 18 for (int i = 0; i < 500000; i++) { |
| 19 arrays.add(new List(260)); |
| 20 arrays.add(new List(1)); |
| 21 } |
| 22 // Clear the large items so that the heap is full of 260-word gaps. |
| 23 for (int i = 0; i < arrays.length; i += 2) { |
| 24 arrays[i] = null; |
| 25 } |
| 26 // Allocate a lot of 300-word objects that don't fit in the gaps. |
| 27 for (int i = 0; i < 600000; i++) { |
| 28 arrays.add(new List(300)); |
| 29 } |
| 30 } |
OLD | NEW |