pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

  • <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="ewlz0re" 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="3vv9w5y" 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="x5zn3yf" id='vBoJK'><tfoot id='vBoJK'></tfoot><dl id='vBoJK'><fieldset id='vBoJK'></fieldset></dl></div>

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

                          • 主站蜘蛛池模板: 多功能干燥机,过滤洗涤干燥三合一设备-无锡市张华医药设备有限公司 | 骁龙云呼电销防封号系统-axb电销平台-外呼稳定『免费试用』 | 考勤系统_人事考勤管理系统_本地部署BS考勤系统_考勤软件_天时考勤管理专家 | 东莞猎头公司_深圳猎头公司_广州猎头公司-广东万诚猎头提供企业中高端人才招聘服务 | 二手注塑机回收_旧注塑机回收_二手注塑机买卖 - 大鑫二手注塑机 二手光谱仪维修-德国OBLF光谱仪|进口斯派克光谱仪-热电ARL光谱仪-意大利GNR光谱仪-永晖检测 | 本安接线盒-本安电路用接线盒-本安分线盒-矿用电话接线盒-JHH生产厂家-宁波龙亿电子科技有限公司 | 对夹式止回阀_对夹式蝶形止回阀_对夹式软密封止回阀_超薄型止回阀_不锈钢底阀-温州上炬阀门科技有限公司 | 泥浆在线密度计厂家-防爆数字压力表-膜盒-远传压力表厂家-江苏大亚自控设备有限公司 | 诺冠气动元件,诺冠电磁阀,海隆防爆阀,norgren气缸-山东锦隆自动化科技有限公司 | 长城人品牌官网| 干式变压器厂_干式变压器厂家_scb11/scb13/scb10/scb14/scb18干式变压器生产厂家-山东科锐变压器有限公司 | 首页-浙江橙树网络技术有限公司| 北京京云律师事务所| 魔方网-培训咨询服务平台| 不发火防静电金属骨料_无机磨石_水泥自流平_修补砂浆厂家「圣威特」 | 工业雾炮机_超细雾炮_远程抑尘射雾器-世纪润德环保设备 | 对夹式止回阀_对夹式蝶形止回阀_对夹式软密封止回阀_超薄型止回阀_不锈钢底阀-温州上炬阀门科技有限公司 | 临海涌泉蜜桔官网|涌泉蜜桔微商批发代理|涌泉蜜桔供应链|涌泉蜜桔一件代发 | 上海新光明泵业制造有限公司-电动隔膜泵,气动隔膜泵,卧式|立式离心泵厂家 | 同步带轮_同步带_同步轮_iHF合发齿轮厂家-深圳市合发齿轮机械有限公司 | 蓝米云-专注于高性价比香港/美国VPS云服务器及海外公益型免费虚拟主机 | 电镀整流器_微弧氧化电源_高频电解电源_微弧氧化设备厂家_深圳开瑞节能 | 氧化锆纤维_1800度高温退火炉_1800度高温烧结炉-南京理工宇龙新材料股份有限公司 | 动库网动库商城-体育用品专卖店:羽毛球,乒乓球拍,网球,户外装备,运动鞋,运动包,运动服饰专卖店-正品运动品网上商城动库商城网 - 动库商城 | 点焊机-缝焊机-闪光对焊机-电阻焊设备生产厂家-上海骏腾发智能设备有限公司 | 空心明胶胶囊|植物胶囊|清真胶囊|浙江绿键胶囊有限公司欢迎您! | 金属检测机_金属分离器_检针验针机_食品药品金属检探测仪器-广东善安科技 | 河南卓美创业科技有限公司-河南卓美防雷公司-防雷接地-防雷工程-重庆避雷针-避雷器-防雷检测-避雷带-避雷针-避雷塔、机房防雷、古建筑防雷等-山西防雷公司 | 压滤机滤板_厢式_隔膜_板框压滤机滤板厂家价格型号材质-大凯环保 | 气动|电动调节阀|球阀|蝶阀-自力式调节阀-上海渠工阀门管道工程有限公司 | 海外整合营销-独立站营销-社交媒体运营_广州甲壳虫跨境网络服务 焊管生产线_焊管机组_轧辊模具_焊管设备_焊管设备厂家_石家庄翔昱机械 | 长沙网站建设制作「网站优化推广」-网页设计公司-速马科技官网 | 物联网卡_物联网卡购买平台_移动物联网卡办理_移动联通电信流量卡通信模组采购平台? | 天津暖气片厂家_钢制散热器_天津铜铝复合暖气片_维尼罗散热器 | 心肺复苏模拟人|医学模型|急救护理模型|医学教学模型上海康人医学仪器设备有限公司 | 电子万能试验机_液压拉力试验机_冲击疲劳试验机_材料试验机厂家-济南众标仪器设备有限公司 | PVC地板|PVC塑胶地板|PVC地板厂家|地板胶|防静电地板-无锡腾方装饰材料有限公司-咨询热线:4008-798-128 | 冷却塔厂家_冷却塔维修_冷却塔改造_凉水塔配件填料公司- 广东康明节能空调有限公司 | 绿萝净除甲醛|深圳除甲醛公司|测甲醛怎么收费|培训机构|电影院|办公室|车内|室内除甲醛案例|原理|方法|价格立马咨询 | 臭氧老化试验箱,高低温试验箱,恒温恒湿试验箱,防水试验设备-苏州亚诺天下仪器有限公司 | 气动球阀_衬氟蝶阀_调节阀_电动截止阀_上海沃托阀门有限公司 |