Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
138 lines (108 sloc) 2.17 KB
{{+bindTo:partials.standard_devtools_article}}
<!DOCTYPE html>
<h1>Example 10</h1>
<h1>Example 10: Retaining path &amp; dominators</h1>
<ol>
<li>Create path.</li>
<li>Take heap snapshot.</li>
<li>Select 'Dominators' view</li>
</ol>
<p><button onclick="createObjects()">Create objects</button></p>
<script>
'use strict';
var path;
function largStr() {
return new Array(1000000).join('x');
}
function Z1(child1) {
this.child1 = child1;
}
function Z2(child1) {
this.child1 = child1;
}
function Y1(child1, child2) {
this.child1 = child1;
this.child2 = child2;
}
function Y2() {
}
function X1(child1) {
this.child1 = child1;
}
function X2(child1) {
this.child1 = child1;
}
function X3(child1) {
this.child1 = child1;
}
function W(child1, child2, child3) {
this.child1 = child1;
this.child2 = child2;
this.child3 = child3;
}
function Item() {
this.content = largStr();
}
function createObjects() {
var item = new Item(),
z1 = new Z1(item),
z2 = new Z2(item),
y1 = new Y1(z1, z2),
y2 = new Y2(),
x1 = new X1(y1),
x2 = new X2(y1),
x3 = new X3(y2),
w = new W(x1, x2, x3);
path = w;
}
</script>
<hr>
<pre>
'use strict';
var path;
function largStr() {
return new Array(1000000).join('x');
}
function Z1(child1) {
this.child1 = child1;
}
function Z2(child1) {
this.child1 = child1;
}
function Y1(child1, child2) {
this.child1 = child1;
this.child2 = child2;
}
function Y2() {
}
function X1(child1) {
this.child1 = child1;
}
function X2(child1) {
this.child1 = child1;
}
function X3(child1) {
this.child1 = child1;
}
function W(child1, child2, child3) {
this.child1 = child1;
this.child2 = child2;
this.child3 = child3;
}
function Item() {
this.content = largStr();
}
function createObjects() {
var item = new Item(),
z1 = new Z1(item),
z2 = new Z2(item),
y1 = new Y1(z1, z2),
y2 = new Y2(),
x1 = new X1(y1),
x2 = new X2(y1),
x3 = new X3(y2),
w = new W(x1, x2, x3);
path = w;
}
</pre>
{{/partials.standard_devtools_article}}
You can’t perform that action at this time.