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

Unified Diff: runtime/observatory/tests/service/get_isolate_after_out_of_memory_error_test.dart

Issue 2080383003: Make OutOfMemory test work on 32 bit machines. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Explained how we obtain the OutOfMemoryError on all platforms Created 4 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/tests/service/get_isolate_after_out_of_memory_error_test.dart
diff --git a/runtime/observatory/tests/service/get_isolate_after_out_of_memory_error_test.dart b/runtime/observatory/tests/service/get_isolate_after_out_of_memory_error_test.dart
index 24bb08319dd72a024127d04f15970d5bd482e443..2cdf4a0a81dc93542970787f0e80f66c92f42254 100644
--- a/runtime/observatory/tests/service/get_isolate_after_out_of_memory_error_test.dart
+++ b/runtime/observatory/tests/service/get_isolate_after_out_of_memory_error_test.dart
@@ -10,7 +10,18 @@ import 'service_test_common.dart';
import 'dart:math';
void goOutOfMemory() {
- new List(pow(2, 53));
+ // Trying to allocate an array larger than Array::kMaxElements
+ // results in a RangeError instead of an OutOfMemoryError.
+ // To always obtain an OutOfMemoryError we create more than one List.
+ List<List> out = <List>[];
+ // This generates an exception on 32 bit machines.
+ for (var i = 0; i < 8; i++) {
+ out.add(new List(pow(2, 28) - 1));
+ }
+ // This generates an exception on 64 bit machines.
+ for (var i = 0; i < 64; i++) {
+ out.add(new List(pow(2, 58) - 1));
+ }
}
var tests = [
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698