Chromium Code Reviews| Index: tests/language/vm/closure_memory_retention_test.dart |
| =================================================================== |
| --- tests/language/vm/closure_memory_retention_test.dart (revision 0) |
| +++ tests/language/vm/closure_memory_retention_test.dart (revision 0) |
| @@ -0,0 +1,25 @@ |
| +// Copyright (c) 2014, 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. |
| +// VMOptions=--old_gen_heap_size=50 |
| + |
| +// Test that non-capturing closures don't retain unnecessary memory. |
| + |
| +import "package:expect/expect.dart"; |
| + |
| +foo() { |
| + return () { }; |
| +} |
| + |
| +bar(a, b) { |
| + f() => [a, b]; |
|
hausner
2014/10/30 17:07:27
Would be nice to add a comment that explains what
Florian Schneider
2014/10/30 17:21:58
Done.
|
| + return foo(); |
| +} |
| + |
| +main() { |
| + var closure = null; |
| + for (var i = 0; i < 100; i++) { |
| + closure = bar(closure, new List(1024 * 1024)); |
| + } |
| + Expect.isTrue(closure is Function); |
| +} |