mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 10:33:28 +00:00
[test] Make less memory be gated by finalization in splay_dart_finalizer_test.dart.
When the heap limit is reached, directly unreachable objects are reclaimed but objects that will be unreachable after a finalization are not, and there needs to be enough headroom between opportunities for finalizers to run (returning to the event loop). So only do the finalization thing with the upper, high-mutation part of the splay tree and remove it from the lower, write-once part. The high-mutation part is what's more interesting for GC stress testing. Bug: https://github.com/dart-lang/sdk/issues/50597 Change-Id: Id02b38b0ac1e9bb640954ef1b686ce3eef8370af Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273300 Reviewed-by: Daco Harkes <dacoharkes@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
parent
e9a1248fc2
commit
16149782ef
|
@ -27,7 +27,7 @@
|
|||
// VMOptions=--verify_store_buffer
|
||||
// VMOptions=--verify_after_marking
|
||||
// VMOptions=--stress_write_barrier_elimination
|
||||
// VMOptions=--old_gen_heap_size=300
|
||||
// VMOptions=--old_gen_heap_size=150
|
||||
|
||||
import "splay_common.dart";
|
||||
|
||||
|
@ -41,26 +41,9 @@ class FinalizerSplay extends Splay {
|
|||
Node newNode(num key, Object? value) => new FinalizerNode(key, value);
|
||||
}
|
||||
|
||||
final payloadLeft = <Object, dynamic>{};
|
||||
final payloadRight = <Object, dynamic>{};
|
||||
finalizePayload(Object token) {
|
||||
payloadLeft.remove(token);
|
||||
payloadRight.remove(token);
|
||||
}
|
||||
|
||||
final payloadFinalizer = new Finalizer<Object>(finalizePayload);
|
||||
|
||||
class Payload {
|
||||
Payload(left, right) {
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
payloadFinalizer.attach(this, token, detach: this);
|
||||
}
|
||||
var token = new Object();
|
||||
get left => payloadLeft[token];
|
||||
set left(value) => payloadLeft[token] = value;
|
||||
get right => payloadRight[token];
|
||||
set right(value) => payloadRight[token] = value;
|
||||
Payload(this.left, this.right);
|
||||
var left, right;
|
||||
|
||||
static generate(depth, tag) {
|
||||
if (depth == 0) return new Leaf(tag);
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
// VMOptions=--verify_store_buffer
|
||||
// VMOptions=--verify_after_marking
|
||||
// VMOptions=--stress_write_barrier_elimination
|
||||
// VMOptions=--old_gen_heap_size=300
|
||||
// VMOptions=--old_gen_heap_size=150
|
||||
|
||||
import "splay_common.dart";
|
||||
|
||||
|
@ -45,26 +45,9 @@ class FinalizerSplay extends Splay {
|
|||
Node newNode(num key, Object value) => new FinalizerNode(key, value);
|
||||
}
|
||||
|
||||
final payloadLeft = <Object, dynamic>{};
|
||||
final payloadRight = <Object, dynamic>{};
|
||||
finalizePayload(Object token) {
|
||||
payloadLeft.remove(token);
|
||||
payloadRight.remove(token);
|
||||
}
|
||||
|
||||
final payloadFinalizer = new Finalizer<Object>(finalizePayload);
|
||||
|
||||
class Payload {
|
||||
Payload(left, right) {
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
payloadFinalizer.attach(this, token, detach: this);
|
||||
}
|
||||
var token = new Object();
|
||||
get left => payloadLeft[token];
|
||||
set left(value) => payloadLeft[token] = value;
|
||||
get right => payloadRight[token];
|
||||
set right(value) => payloadRight[token] = value;
|
||||
Payload(this.left, this.right);
|
||||
var left, right;
|
||||
|
||||
static generate(depth, tag) {
|
||||
if (depth == 0) return new Leaf(tag);
|
||||
|
|
Loading…
Reference in a new issue