Files
sdk/tests/standalone_2/fragmentation_test.dart
T
Ryan Macnak d965998d1c [vm] Begin a sliding compactor.
Improves the space overhead of compaction from O(size of live objects) to O(number of live objects).

Future work includes: 
 - a smaller, faster representation the forwarding table via a bitmap of used allocation units
 - sorting class sizes off-heap to allow sliding classes
 - running forwarding in parallel

Removes unnecessary sweep from evacuating compactor.

Change-Id: If0991bfb75573201c6e8feed142ca0cc69fccab4
Bug: https://github.com/dart-lang/sdk/issues/30978
Reviewed-on: https://dart-review.googlesource.com/15988
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Erik Corry <erikcorry@google.com>
2017-10-25 21:57:08 +00:00

33 lines
1.2 KiB
Dart

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