-
Notifications
You must be signed in to change notification settings - Fork 128
/
Copy pathexample-07.html
41 lines (41 loc) · 1.07 KB
/
example-07.html
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
40
41
<!DOCTYPE html>
<html>
<head>
<title>Example 7</title>
</head>
<body>
<!DOCTYPE html>
<h1>Example 7</h1>
<h2>Example 7: Eval is evil (almost always)</h2>
<p>Analyze the impact of closures on memory</p>
<p>
See that <code>eval</code> retains a reference on all the variables of the
closure.
</p>
<ol>
<li>Start the creation of new closures</li>
<li>Take a heap snapshot</li>
<li>
Find the closures (named <code>lC</code>, <code>sC</code>, and
<code>eC</code>)
</li>
</ol>
<p>
<button onclick="largeClosures()">
Closures maintain hold on large string
</button>
</p>
<p>
<button onclick="smallClosures()">
Closures maintain hold only on small strings
</button>
</p>
<p>
<button onclick="evalClosures()">Closures with <code>eval</code></button>
</p>
<p><button onclick="stopAndClear()">Stop and clear</button></p>
<script src="example-07.js"></script>
<hr />
<iframe src="example-07.js"></iframe>
</body>
</html>