1description( 2"This test checks whether the GC collects after string appends." 3); 4 5// FIXME: This test appears to be highly tied to the details of how JS strings report memory 6// cost to the garbage collector. It should be improved to be less tied to these implementation details. 7// <https://bugs.webkit.org/show_bug.cgi?id=20871> 8 9if (window.layoutTestController) 10 layoutTestController.dumpAsText(); 11 12if (window.GCController) 13 GCController.collect(); 14 15 16// str has 150 chars in it (which is greater than the limit of the GC to ignore which I believe is at 128). 17var str = "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"; 18var count = 500; 19for (var i = 0; i < count; ++i) { 20 str += "b"; 21} 22 23// str has 128 chars in it. 24str = "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"; 25count = 10; 26for (var i = 0; i < count; ++i) { 27 str += str; 28} 29 30var jsObjCount = 0; 31if (window.GCController) 32 jsObjCount = GCController.getJSObjectCount(); 33 34if (jsObjCount <= 500 && jsObjCount > 0) 35 testPassed("Garbage Collector triggered") 36else 37 testFailed("Garbage Collector NOT triggered. Number of JSObjects: " + jsObjCount); 38 39var successfullyParsed = true; 40