久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <small id='1rP1r'></small><noframes id='1rP1r'>

      <legend id='1rP1r'><style id='1rP1r'><dir id='1rP1r'><q id='1rP1r'></q></dir></style></legend>

        <tfoot id='1rP1r'></tfoot>

        • <bdo id='1rP1r'></bdo><ul id='1rP1r'></ul>
        <i id='1rP1r'><tr id='1rP1r'><dt id='1rP1r'><q id='1rP1r'><span id='1rP1r'><b id='1rP1r'><form id='1rP1r'><ins id='1rP1r'></ins><ul id='1rP1r'></ul><sub id='1rP1r'></sub></form><legend id='1rP1r'></legend><bdo id='1rP1r'><pre id='1rP1r'><center id='1rP1r'></center></pre></bdo></b><th id='1rP1r'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='1rP1r'><tfoot id='1rP1r'></tfoot><dl id='1rP1r'><fieldset id='1rP1r'></fieldset></dl></div>

        主線程忙時可以進行垃圾收集嗎?

        Can garbage collection happen while the main thread is busy?(主線程忙時可以進行垃圾收集嗎?)

        <small id='0HRV7'></small><noframes id='0HRV7'>

      1. <i id='0HRV7'><tr id='0HRV7'><dt id='0HRV7'><q id='0HRV7'><span id='0HRV7'><b id='0HRV7'><form id='0HRV7'><ins id='0HRV7'></ins><ul id='0HRV7'></ul><sub id='0HRV7'></sub></form><legend id='0HRV7'></legend><bdo id='0HRV7'><pre id='0HRV7'><center id='0HRV7'></center></pre></bdo></b><th id='0HRV7'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='0HRV7'><tfoot id='0HRV7'></tfoot><dl id='0HRV7'><fieldset id='0HRV7'></fieldset></dl></div>
        <legend id='0HRV7'><style id='0HRV7'><dir id='0HRV7'><q id='0HRV7'></q></dir></style></legend>

          <bdo id='0HRV7'></bdo><ul id='0HRV7'></ul>
            <tbody id='0HRV7'></tbody>

              1. <tfoot id='0HRV7'></tfoot>

                • 本文介紹了主線程忙時可以進行垃圾收集嗎?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  假設我有一個長時間運行的循環:

                  Let's say I have a long running loop:

                  // Let's say this loop takes 10 seconds to execute
                  for(let i = 0; i <= 1000000; ++i) {
                      const garbage = { i };
                      // some other code
                  }
                  

                  垃圾收集器可以在循環期間運行,還是只能在應用空閑時運行?

                  Can the garbage collector run during the loop, or it can only run when the application is idle?

                  我沒有找到任何與此相關的文檔,但是因為 Node.js 具有理論上禁用 GC 的 --nouse-idle-notification,讓我認為 GC 僅在以下情況下運行發送空閑通知(當主線程不忙時).

                  I didn't find any documentation related to this, but because Node.js has the --nouse-idle-notification which in theory disables GC, makes me think that the GC only runs when the idle notification is sent (when the main thread is not busy).

                  我之所以問這個問題是因為我的循環有時會出現執行時間峰值,并且想知道 GC 是否有可能在循環期間運行,從而導致延遲峰值.

                  I am asking this because my loop sometimes has spikes in execution time and want to know if it's possible that the GC might run during the loop, resulting in the lag spike.

                  推薦答案

                  V8 開發者在這里.簡短的回答是 GC 可以隨時運行,并且會在需要時運行.

                  V8 developer here. The short answer is that the GC can run at any time and will run whenever it needs to.

                  請注意,GC 是一個相當復雜的系統:它執行多個不同的任務,并且大部分以增量步驟和/或與主線程同時執行.特別是,每次分配都會觸發一些增量 GC 工作.(這意味著通過非常小心地避免所有分配,您可以構建在運行時不會導致 GC 活動的循環;但循環不會積累無法收集的垃圾——除非您的內存中有泄漏當然是代碼,其中對象無意中保持可訪問性.)

                  Note that the GC is a fairly complex system: it performs several different tasks, and does most of them in incremental steps and/or concurrently with the main thread. In particular, every allocation can trigger a bit of incremental GC work. (Which implies that by very carefully avoiding all allocations, you can construct loops that won't cause GC activity while they run; but it's never the case that loops accumulate garbage that can't get collected -- unless you have a leak in your code of course, where objects are unintentionally being kept reachable.)

                  垃圾收集器可以在循環期間運行,還是只能在應用空閑時運行?

                  Can the garbage collector run during the loop, or it can only run when the application is idle?

                  它絕對可以并且將在循環期間運行.

                  It absolutely can and will run during the loop.

                  Node.js 有 --nouse-idle-notification 理論上禁用 GC

                  Node.js has the --nouse-idle-notification which in theory disables GC

                  不,它沒有.沒有辦法禁用 GC.該標志禁用了觸發 GC 活動的一種特定機制,但這僅意味著 GC 將由其他機制觸發.

                  No, it does not. There is no way to disable GC. That flag disables one particular mechanism for triggering GC activity, but that only means that GC will be triggered by other mechanisms.

                  GC 只在發送空閑通知時運行(當主線程不忙時)

                  the GC only runs when the idle notification is sent (when the main thread is not busy)

                  不,我們的想法是在空閑時間運行一些額外個 GC 周期,以便在應用程序不忙時節省一些內存.

                  No, the idea is to run some extra GC cycles when there is idle time, to save some memory when the application is not busy.

                  我的循環有時會出現執行時間峰值,想知道 GC 是否有可能在循環期間運行,從而導致延遲峰值

                  my loop sometimes has spikes in execution time and want to know if it's possible that the GC might run during the loop, resulting in the lag spike

                  可能是這樣.它也可能與函數的優化或去優化有關.或者它可能是其他原因——例如,操作系統中斷了您的進程或將其分配給另一個 CPU 內核,或數百個其他原因.計算機是復雜的機器;-)

                  That could be. It could possibly also have to do with optimization or deoptimization of the function. Or it could be something else -- the operating system interrupting your process or assigning it to another CPU core, for example, or hundreds of other reasons. Computers are complex machines ;-)

                  如果您將變量設置為 null -- 垃圾收集會立即完成

                  if you set a variable to null -- garbage collection is done immediately

                  不,不是.垃圾收集永遠不會立即完成(至少在 V8 中不會).

                  No, it is not. Garbage collection is never done immediately (at least not in V8).

                  這篇關于主線程忙時可以進行垃圾收集嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                  JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                  XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)
                  Restrictions of XMLHttpRequest#39;s getResponseHeader()?(XMLHttpRequest 的 getResponseHeader() 的限制?)
                  <legend id='vBoJK'><style id='vBoJK'><dir id='vBoJK'><q id='vBoJK'></q></dir></style></legend>
                  • <bdo id='vBoJK'></bdo><ul id='vBoJK'></ul>
                    <tfoot id='vBoJK'></tfoot>

                          <tbody id='vBoJK'></tbody>
                        <i id='vBoJK'><tr id='vBoJK'><dt id='vBoJK'><q id='vBoJK'><span id='vBoJK'><b id='vBoJK'><form id='vBoJK'><ins id='vBoJK'></ins><ul id='vBoJK'></ul><sub id='vBoJK'></sub></form><legend id='vBoJK'></legend><bdo id='vBoJK'><pre id='vBoJK'><center id='vBoJK'></center></pre></bdo></b><th id='vBoJK'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='vBoJK'><tfoot id='vBoJK'></tfoot><dl id='vBoJK'><fieldset id='vBoJK'></fieldset></dl></div>

                            <small id='vBoJK'></small><noframes id='vBoJK'>

                          • 主站蜘蛛池模板: 色婷婷国产精品 | 免费在线一区二区三区 | 欧美日韩不卡在线 | 国产精品99| 99精品网 | 精品在线一区二区三区 | 日韩在线播放av | 欧美一级特黄aaa大片在线观看 | 亚州中文字幕 | 91在线精品视频 | 一级黄在线观看 | 罗宾被扒开腿做同人网站 | 91精品久久久久久久久久入口 | 九九热精品在线 | 天天摸天天干 | 伊人一二三 | 免费观看一级特黄欧美大片 | 在线观看成年视频 | 日韩在线| 免费国产一区 | 精品一区二区三区四区外站 | 97伊人| 一区二区三区视频在线观看 | 亚洲性人人天天夜夜摸 | 亚洲精品乱码久久久久久蜜桃91 | 一区二区不卡视频 | 国产久视频 | 久久蜜桃av一区二区天堂 | 黄色毛片免费视频 | 国产精品久久久久久久免费大片 | 亚洲精品久久久久久久久久吃药 | 日本一区二区三区在线观看 | 亚洲一区免费视频 | 成人久久 | 综合色久 | 国产免费一区二区三区 | 亚洲精品在线视频 | 一区二区在线 | 日韩成人免费视频 | 国产高潮好爽受不了了夜色 | 殴美成人在线视频 |