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;









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:



enter image description here



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?










share|improve this question
































    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:



    enter image description here



    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?










    share|improve this question




























      0












      0








      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:



      enter image description here



      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?










      share|improve this question
















      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:



      enter image description here



      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 google-chrome highcharts tabs setinterval






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      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

























          1 Answer
          1






          active

          oldest

          votes


















          1
















          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);







          share|improve this answer




























            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
            );



            );














            draft saved

            draft discarded
















            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









            1
















            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);







            share|improve this answer































              1
















              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);







              share|improve this answer





























                1














                1










                1









                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);







                share|improve this answer















                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);








                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Apr 1 at 18:15

























                answered Mar 28 at 21:11









                AsyranokAsyranok

                6844 silver badges13 bronze badges




                6844 silver badges13 bronze badges

































                    draft saved

                    draft discarded















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                    155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해