J
J
John2017-01-31 02:31:34
safari
John, 2017-01-31 02:31:34

Why did safari start eating all the resources?

Why, after running Safari, does it eat all the CPU? And does not respond to the cmd + q command, writes that "Safari (does not respond)"? Although if you enter under the "Guest" account, then everything is fine. And the load appeared just suddenly, did not install anything. I have already removed all extensions from the browser, and even removed many software programs, but nothing helps. It can only be closed by force.
Here is such a load
27a897f28b8c4a0486fd9459b8176d55.jpg
And this is after the command cmd + q
8f090b7dd4e549098add362b66654fd5.jpg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
John Doe, 2017-01-31
@Homchenkokostya

The problem was solved by creating a new user account, and the old account was deleted, since it was still stupid.

0
0xD34F, 2017-08-26
@campus1

Because all the functions passed to setTimeout are called after the loop is completed - and the value of i by that moment will be equal to 10.
How to fix it? It is possible like this:

for (var i = 0; i < 10; i++) {
  setTimeout(function() {
    alert(+this);
  }.bind(i), 100);
}

Or like this:
for (let i = 0; i < 10; i++) {
  setTimeout(function() {
    alert(i);
  }, 100);
}

Or like this:
for (var i = 0; i < 10; i++) {
  setTimeout(function(i) {
    alert(i);
  }, 100, i);
}

True, there is no guarantee that the order of calls will be correct. To get around this problem, you can set the interval not the same for everyone - 100, but different, for example - 100 * i. And you can make it so that the order of calls is not important - reset the counter after the end of the loop, and output not i, but i++:
for (var i=0; i < 10; i++) {
  setTimeout(function() {
    alert(i++);
  }, 100);
}
i = 0;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question