summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/js/resources/garbage-collect-after-string-appends.js-disabled
blob: 1ec03ce8b624ce521c53753d0ee7f74897ce0fdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
description(
"This test checks whether the GC collects after string appends."
);

// FIXME: This test appears to be highly tied to the details of how JS strings report memory
// cost to the garbage collector.  It should be improved to be less tied to these implementation details.
// <https://bugs.webkit.org/show_bug.cgi?id=20871>

if (window.layoutTestController)
    layoutTestController.dumpAsText();

if (window.GCController)
    GCController.collect();


// str has 150 chars in it (which is greater than the limit of the GC to ignore which I believe is at 128).
var str = "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
var count = 500;
for (var i = 0; i < count; ++i) {
    str += "b";
}

// str has 128 chars in it.
str = "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
count = 10;
for (var i = 0; i < count; ++i) {
    str += str;
}

var jsObjCount = 0;
if (window.GCController)
    jsObjCount = GCController.getJSObjectCount();

if (jsObjCount <= 500 && jsObjCount > 0)
    testPassed("Garbage Collector triggered")
else
    testFailed("Garbage Collector NOT triggered. Number of JSObjects: " + jsObjCount);

var successfullyParsed = true;