SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 30 day free trial to unlock unlimited reading.
"Работа с утечками в V8", Роман Кривцов, MoscowJS 19
6.
— Concept of reachability
— Blocked event-loop
— Totally optimising
(partions, dynamic intervals)
— New space (1-8Mb)
& Old space (512Mb-1.7Gb)
6
GC
14.
14
Scopes
clickhtml
latestNews html
clickhtml
clickhtml
clickhtml
15.
15
var latestNews = function (html) {
var container = document.getElementById("news");
container.innerHTML = html;
container.addEventListener("click", function click() {
showFullItem();
});
var unused = function () {
if (html) console.log("never");
}
}
setInterval(XHR.bind(null, "/get_news", latestNews), 1000);
Deeper down the rabbit hole
17.
17
Scopes
click
latestNews html
unusedhtmlhtml =
18.
18
var latestNews = function (html) {
var container = document.getElementById("news");
container.innerHTML = html;
html = null;
container.addEventListener("click", function click() {
showFullItem(html);
});
}
setInterval(XHR.bind(null, "/get_news", latestNews), 1000);
19.
var job = function () {
mysql.query("select * from tasks order by ts desc",
function (err, res) {
use(res);
});
}
setInterval(job, 1000);
19
Long responses
mysql.query({
sql: 'select * from tasks order by ts',
timeout: 1000
});