Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1845)

Unified Diff: tests/standalone/fragmentation_test.dart

Issue 2872883003: Avoid scanning huge freelists for large enough free blocks. (Closed)
Patch Set: Rename test file Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« runtime/vm/freelist.cc ('K') | « runtime/vm/freelist.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/fragmentation_test.dart
diff --git a/tests/standalone/fragmentation_test.dart b/tests/standalone/fragmentation_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..3e4fb55efaa59c38dba8d362d3e9553406fccad7
--- /dev/null
+++ b/tests/standalone/fragmentation_test.dart
@@ -0,0 +1,30 @@
+// 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
kustermann 2017/05/10 21:39:40 That might be a bit too much memory for arm device
+// 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
+
+main() {
+ List<String> arrays = [];
kustermann 2017/05/10 21:39:40 List<String> -> final List<List> ?
+ // 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));
+ }
+}
« runtime/vm/freelist.cc ('K') | « runtime/vm/freelist.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698