Memory heap increases when Chrome tab is inactivechrome extension memory hog with basic functionHow can I make setInterval also work when a tab is inactive in Chrome?JavaScript setTimeout and Chrome memory utilizationForcing garbage collection in Google ChromeChrome dev tools first memory heap snapshot is mysteriously largeChrome Custom Tabs and push notificationsJavascript animation goes wrong when tab is inactivesetInterval doesn't slow down on inactive tabrequestAnimationFrame on react - doesn't stop state updates when tab is inactiveJS heap size increase when inactive tab
The answer is a girl's name (my future granddaughter) - can anyone help?
Giving a good fancy look to a simple table
Would a horse be sufficient buffer to prevent injury when falling from a great height?
General method to output dd1,d2,d3...dn in AnyDice
What makes a character irredeemable?
Why is there such a singular place for bird watching?
Duck, duck, gone!
Did Joe Biden "stop a prosecution" into his son in Ukraine? And did he brag about stopping the prosecution?
If I travelled back in time to invest in X company to make a fortune, roughly what is the probability that it would fail?
How can I find places to store/land a private airplane?
Lighthouse Alternatives
Why has Speaker Pelosi been so hesitant to impeach President Trump?
Isn't the detector always measuring, and thus always collapsing the state?
French license plates
Does the US Armed Forces refuse to recruit anyone with an IQ less than 83?
Why did they use ultrafast diodes in a 50 or 60 Hz bridge?
Why do popular TCP-using services have UDP as well as TCP entries in /etc/services?
Airport Security - advanced check, 4th amendment breach
When Vesuvan Shapeshifter copies turn face up replacement effects, why do they work?
Notation clarity question for a conglomerate of accidentals
Can I cast Death Ward on additional creatures without causing previous castings to end?
Parent asking for money after moving out
Did the Soviet army intentionally send troops (e.g. penal battalions) running over minefields?
IEEE 754 square root with Newton-Raphson
Memory heap increases when Chrome tab is inactive
chrome extension memory hog with basic functionHow can I make setInterval also work when a tab is inactive in Chrome?JavaScript setTimeout and Chrome memory utilizationForcing garbage collection in Google ChromeChrome dev tools first memory heap snapshot is mysteriously largeChrome Custom Tabs and push notificationsJavascript animation goes wrong when tab is inactivesetInterval doesn't slow down on inactive tabrequestAnimationFrame on react - doesn't stop state updates when tab is inactiveJS heap size increase when inactive tab
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
Using React and HighCharts to build a dashboard refreshed every 10 seconds using setInterval.
- when browser tab is active there is no memory heap problem.
- when browser tab is inactive there is a constant increase in the memory heap.
- when open back up the tab there is an instant drop in the memory heap.
The real problem is that my web application freezes when tab is left inactive for too long.
A screenshot of the memory heap:

UPDATE:
It looks this is is the problem:
https://developers.google.com/web/updates/2017/03/background_tabs
Chrome doesn't call requestAnimationFrame() when tab is inactive.
How do people solve this problem?
reactjs
add a comment
|
Using React and HighCharts to build a dashboard refreshed every 10 seconds using setInterval.
- when browser tab is active there is no memory heap problem.
- when browser tab is inactive there is a constant increase in the memory heap.
- when open back up the tab there is an instant drop in the memory heap.
The real problem is that my web application freezes when tab is left inactive for too long.
A screenshot of the memory heap:

UPDATE:
It looks this is is the problem:
https://developers.google.com/web/updates/2017/03/background_tabs
Chrome doesn't call requestAnimationFrame() when tab is inactive.
How do people solve this problem?
reactjs
add a comment
|
Using React and HighCharts to build a dashboard refreshed every 10 seconds using setInterval.
- when browser tab is active there is no memory heap problem.
- when browser tab is inactive there is a constant increase in the memory heap.
- when open back up the tab there is an instant drop in the memory heap.
The real problem is that my web application freezes when tab is left inactive for too long.
A screenshot of the memory heap:

UPDATE:
It looks this is is the problem:
https://developers.google.com/web/updates/2017/03/background_tabs
Chrome doesn't call requestAnimationFrame() when tab is inactive.
How do people solve this problem?
reactjs
Using React and HighCharts to build a dashboard refreshed every 10 seconds using setInterval.
- when browser tab is active there is no memory heap problem.
- when browser tab is inactive there is a constant increase in the memory heap.
- when open back up the tab there is an instant drop in the memory heap.
The real problem is that my web application freezes when tab is left inactive for too long.
A screenshot of the memory heap:

UPDATE:
It looks this is is the problem:
https://developers.google.com/web/updates/2017/03/background_tabs
Chrome doesn't call requestAnimationFrame() when tab is inactive.
How do people solve this problem?
reactjs
reactjs
edited Mar 28 at 21:05
Francesco Meli
asked Mar 28 at 20:42
Francesco MeliFrancesco Meli
9868 silver badges28 bronze badges
9868 silver badges28 bronze badges
add a comment
|
add a comment
|
1 Answer
1
active
oldest
votes
If the dashboard can't be seen, there really isn't a need to update it. If chrome has this issue, I'd recommend just updating it once on re-focus after it is inactive. And while inactive, simply do nothing each loop in your interval.
var IsFocused = true;
window.onfocus = function()
IsFocused = true;
window.onblur = function()
IsFocused = false;
var myinterval = setInterval(function()
if(!IsFocused) return;
some dashboard update code here...
, 10000);
Now if the issue is just that the interval is even running when the tab is inactive, you could just do this too:
var myinterval;
function StartInterval()
clearInterval(myinterval);
myinterval = setInterval(function()
some dashboard update code here...
, 10000);
StartInterval(); //Start on first load.
window.onfocus = function()
StartInterval();
window.onblur = function()
clearInterval(myinterval);
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406538%2fmemory-heap-increases-when-chrome-tab-is-inactive%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If the dashboard can't be seen, there really isn't a need to update it. If chrome has this issue, I'd recommend just updating it once on re-focus after it is inactive. And while inactive, simply do nothing each loop in your interval.
var IsFocused = true;
window.onfocus = function()
IsFocused = true;
window.onblur = function()
IsFocused = false;
var myinterval = setInterval(function()
if(!IsFocused) return;
some dashboard update code here...
, 10000);
Now if the issue is just that the interval is even running when the tab is inactive, you could just do this too:
var myinterval;
function StartInterval()
clearInterval(myinterval);
myinterval = setInterval(function()
some dashboard update code here...
, 10000);
StartInterval(); //Start on first load.
window.onfocus = function()
StartInterval();
window.onblur = function()
clearInterval(myinterval);
add a comment
|
If the dashboard can't be seen, there really isn't a need to update it. If chrome has this issue, I'd recommend just updating it once on re-focus after it is inactive. And while inactive, simply do nothing each loop in your interval.
var IsFocused = true;
window.onfocus = function()
IsFocused = true;
window.onblur = function()
IsFocused = false;
var myinterval = setInterval(function()
if(!IsFocused) return;
some dashboard update code here...
, 10000);
Now if the issue is just that the interval is even running when the tab is inactive, you could just do this too:
var myinterval;
function StartInterval()
clearInterval(myinterval);
myinterval = setInterval(function()
some dashboard update code here...
, 10000);
StartInterval(); //Start on first load.
window.onfocus = function()
StartInterval();
window.onblur = function()
clearInterval(myinterval);
add a comment
|
If the dashboard can't be seen, there really isn't a need to update it. If chrome has this issue, I'd recommend just updating it once on re-focus after it is inactive. And while inactive, simply do nothing each loop in your interval.
var IsFocused = true;
window.onfocus = function()
IsFocused = true;
window.onblur = function()
IsFocused = false;
var myinterval = setInterval(function()
if(!IsFocused) return;
some dashboard update code here...
, 10000);
Now if the issue is just that the interval is even running when the tab is inactive, you could just do this too:
var myinterval;
function StartInterval()
clearInterval(myinterval);
myinterval = setInterval(function()
some dashboard update code here...
, 10000);
StartInterval(); //Start on first load.
window.onfocus = function()
StartInterval();
window.onblur = function()
clearInterval(myinterval);
If the dashboard can't be seen, there really isn't a need to update it. If chrome has this issue, I'd recommend just updating it once on re-focus after it is inactive. And while inactive, simply do nothing each loop in your interval.
var IsFocused = true;
window.onfocus = function()
IsFocused = true;
window.onblur = function()
IsFocused = false;
var myinterval = setInterval(function()
if(!IsFocused) return;
some dashboard update code here...
, 10000);
Now if the issue is just that the interval is even running when the tab is inactive, you could just do this too:
var myinterval;
function StartInterval()
clearInterval(myinterval);
myinterval = setInterval(function()
some dashboard update code here...
, 10000);
StartInterval(); //Start on first load.
window.onfocus = function()
StartInterval();
window.onblur = function()
clearInterval(myinterval);
edited Apr 1 at 18:15
answered Mar 28 at 21:11
AsyranokAsyranok
6844 silver badges13 bronze badges
6844 silver badges13 bronze badges
add a comment
|
add a comment
|
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406538%2fmemory-heap-increases-when-chrome-tab-is-inactive%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown