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

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

    • <bdo id='Pw39O'></bdo><ul id='Pw39O'></ul>
  • <small id='Pw39O'></small><noframes id='Pw39O'>

    <legend id='Pw39O'><style id='Pw39O'><dir id='Pw39O'><q id='Pw39O'></q></dir></style></legend>

        我可以觸發 JavaScript 的垃圾回收嗎?

        Can I trigger JavaScript#39;s garbage collection?(我可以觸發 JavaScript 的垃圾回收嗎?)

          <small id='3pK8b'></small><noframes id='3pK8b'>

          • <legend id='3pK8b'><style id='3pK8b'><dir id='3pK8b'><q id='3pK8b'></q></dir></style></legend>
            • <bdo id='3pK8b'></bdo><ul id='3pK8b'></ul>
                  <tbody id='3pK8b'></tbody>

              • <tfoot id='3pK8b'></tfoot>
                  <i id='3pK8b'><tr id='3pK8b'><dt id='3pK8b'><q id='3pK8b'><span id='3pK8b'><b id='3pK8b'><form id='3pK8b'><ins id='3pK8b'></ins><ul id='3pK8b'></ul><sub id='3pK8b'></sub></form><legend id='3pK8b'></legend><bdo id='3pK8b'><pre id='3pK8b'><center id='3pK8b'></center></pre></bdo></b><th id='3pK8b'></th></span></q></dt></tr></i><div class="5dl7n5z" id='3pK8b'><tfoot id='3pK8b'></tfoot><dl id='3pK8b'><fieldset id='3pK8b'></fieldset></dl></div>
                  本文介紹了我可以觸發 JavaScript 的垃圾回收嗎?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我想觸發 JavaScript 垃圾回收.是否可以?我為什么要或不想這樣做?

                  I want to trigger JavaScript garbage collection. Is it possible? Why would I want to, or not want to, do this?

                  推薦答案

                  我踏上了一小段旅程,想要回答你的一個問題:有可能嗎?

                  I went out on a small journey to seek an answer to one of your questions: Is it possible?

                  全城的人都在說刪除引用就行了.有人說擦除對象是額外的保證(示例).所以我寫了一個腳本來嘗試書中的每一個技巧,我驚訝地發現在 Chrome (22.0.1229.79) 和 IE (9.0.8112.16421) 中,垃圾收集似乎不起作用.Firefox (15.0.1) 的管理沒有任何重大缺陷,除了一個(參見下面的案例 4f).

                  People all over town are saying that deleting the references will do the trick. Some people say that wiping the object is an extra guarantee (example). So I wrote a script that will try every trick in the book, and I was astonished to see that in Chrome (22.0.1229.79) and IE (9.0.8112.16421), garbage collection doesn't even seem to work. Firefox (15.0.1) managed without any major drawbacks apart from one (see case 4f down below).

                  在偽代碼中,測試是這樣的.

                  1. 創建一個容器,一個數組,用于保存某種對象.我們將在此處將此容器稱為 Bertil.

                  其中的每個對象,作為 Bertil 中的一個元素,都應將其自己的數組容器聲明為屬性.該數組將保存大量字節.我們將調用 Bertil 的任何元素,對象Joshua.每個 Joshua 的字節數組將被稱為 Smith.

                  Each and every object therein, as an element in Bertil, shall have his own array-container declared as a property. This array will hold a whole lot of bytes. We'll call any one of Bertil's elements, the object, Joshua. Each Joshua's byte array will be called Smith.

                  這里有一張思維導圖供你參考:

                  Here's a mind map for you to lean back on:

                  Bertil [對象數組] -> Joshua [對象] -> Smith [字節數組] -> 未命名 [字節].

                  Bertil [Array of objects] -> Joshua [Object] -> Smith [Array of bytes] -> Unnamed [Bytes].

                  當我們把可用內存弄得一團糟時,停留一兩秒,然后執行以下任一破壞算法":

                  When we've made a mess out of our available memory, hang around for a sec or two and then execute any one of the following "destruction algorithms":

                  4a.在主對象容器 Bertil 上拋出一個刪除操作數.

                  4a. Throw a delete operand on the main object container, Bertil.

                  4b.對該容器中的每個對象都拋出一個刪除操作數,殺死所有活著的 Joshua.

                  4b. Throw a delete operand on each and every object in that container, kill every Joshua alive.

                  4c.對每個字節數組(Smiths)拋出一個刪除操作數.

                  4c. Throw a delete operand on each and every array of bytes, the Smiths.

                  4d.將 NULL 分配給每個 Joshua.

                  4d. Assign NULL to every Joshua.

                  4e.將 UNDEFINED 分配給每個 Joshua.

                  4e. Assign UNDEFINED to every Joshua.

                  4f.手動刪除任何 Joshua 保存的每個字節.

                  4f. Manually delete each and every byte that any Joshua holds.

                  4g.按正常順序執行上述所有操作.

                  4g. Do all of the above in a working order.

                  那么發生了什么?4a4b 的情況下,沒有瀏覽器的垃圾收集器 (GC) 啟動.在 4c 的情況下到 4e,Firefox 確實啟動并展示了一些概念證明.記憶在一分鐘內很快被回收.使用當前硬編碼的一些變量作為測試配置的默認值,案例 4f4e 導致 Chrome 掛起,所以我不能在那里得出任何結論.您可以自由地使用自己的變量進行自己的測試,鏈接將很快發布.IE 在 4f 和 4e 病例中幸存下來,但他的 GC 像往常一樣死了.出乎意料的是,Firefox 幸存下來但沒有通過 4f.Firefox 幸存下來并通過了 4g.

                  So what happened? In case 4a and 4b, no browser's garbage collector (GC) kicked in. In case 4c to 4e, Firefox did kick in and displayed some proof of concept. Memory was reclaimed shortly within the minute. With current hardcoded default values on some of the variables used as test configuration, case 4f and 4e caused Chrome to hang, so I can't draw any conclusions there. You are free to do your own testing with your own variables, links will be posted soon. IE survived case 4f and 4e but his GC was dead as usual. Unexpectedly, Firefox survived but didn't pass 4f. Firefox survived and passed 4g.

                  在瀏覽器的 GC 未能啟動的所有情況下,等待至少 10 分鐘并不能解決問題.并且重新加載整個頁面會導致內存占用翻倍.

                  In all of the cases when a browser's GC failed to kick in, waiting around for at least 10 minutes didn't solve the problem. And reloading the entire page caused the memory footprint to double.

                  我的結論是我一定在代碼中犯了一個可怕的錯誤,或者你的問題的答案是:不,我們不能觸發 GC.每當我們試圖這樣做時,我們都會受到嚴厲的懲罰,我們應該把頭埋在沙子里.請我鼓勵你繼續,自己嘗試這些測試用例.看看代碼中對細節的評論.另外,下載頁面并重寫腳本,看看是否可以以更合適的方式觸發 GC.我確實失敗了,我一輩子都不能相信 Chrome 和 IE 沒有工作的垃圾收集器.

                  My conclusion is that I must have made a horrible error in the code or the answer to your question is: No we can't trigger the GC. Whenever we try to do so we will be punished severely and we should stick our heads in the sand. Please I encourage you to go ahead, try these test cases on your own. Have a look in the code were comment on the details. Also, download the page and rewrite the script and see if you can trigger the GC in a more proper way. I sure failed and I can't for the life of me believe that Chrome and IE doesn't have a working garbage collector.

                  http://martinandersson.com/dev/gc_test/?case=1

                  http://martinandersson.com/dev/gc_test/?case=2

                  http://martinandersson.com/dev/gc_test/?case=3

                  http://martinandersson.com/dev/gc_test/?case=4

                  http://martinandersson.com/dev/gc_test/?case=5

                  http://martinandersson.com/dev/gc_test/?case=6

                  http://martinandersson.com/dev/gc_test/?case=7

                  這篇關于我可以觸發 JavaScript 的垃圾回收嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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() 的限制?)
                    <bdo id='Oic4q'></bdo><ul id='Oic4q'></ul>

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

                        <legend id='Oic4q'><style id='Oic4q'><dir id='Oic4q'><q id='Oic4q'></q></dir></style></legend>
                              <tbody id='Oic4q'></tbody>

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

                            主站蜘蛛池模板: 医养体检包_公卫随访箱_慢病随访包_家签随访包_随访一体机-济南易享医疗科技有限公司 | 带锯机|木工带锯机圆木推台锯|跑车带锯机|河北茂业机械制造有限公司| | 烽火安全网_加密软件、神盾软件官网 | TYPE-C厂家|TYPE-C接口|TYPE-C防水母座|TYPE-C贴片-深圳步步精 | 二手Sciex液质联用仪-岛津气质联用仪-二手安捷伦气质联用仪-上海隐智科学仪器有限公司 | 网优资讯-为循环资源、大宗商品、工业服务提供资讯与行情分析的数据服务平台 | 苏州同创电子有限公司 - 四探针测试仪源头厂家 | 沧州友城管业有限公司-内外涂塑钢管-大口径螺旋钢管-涂塑螺旋管-保温钢管生产厂家 | 钣金加工厂家-钣金加工-佛山钣金厂-月汇好 | 蓝莓施肥机,智能施肥机,自动施肥机,水肥一体化项目,水肥一体机厂家,小型施肥机,圣大节水,滴灌施工方案,山东圣大节水科技有限公司官网17864474793 | 北京西风东韵品牌与包装设计公司,创造视觉销售力! | 胶原检测试剂盒,弹性蛋白检测试剂盒,类克ELISA试剂盒,阿达木单抗ELISA试剂盒-北京群晓科苑生物技术有限公司 | pos机办理,智能/扫码/二维码/微信支付宝pos机-北京万汇通宝商贸有限公司 | Brotu | 关注AI,Web3.0,VR/AR,GPT,元宇宙区块链数字产业 | 电子厂招聘_工厂招聘_普工招聘_小时工招聘信息平台-众立方招工网 | 地埋式垃圾站厂家【佳星环保】小区压缩垃圾中转站转运站 | 3d可视化建模_三维展示_产品3d互动数字营销_三维动画制作_3D虚拟商城 【商迪3D】三维展示服务商 广东健伦体育发展有限公司-体育工程配套及销售运动器材的体育用品服务商 | 深圳市源和塑胶电子有限公司-首页 | 大通天成企业资质代办_承装修试电力设施许可证_增值电信业务经营许可证_无人机运营合格证_广播电视节目制作许可证 | 网架支座@球铰支座@钢结构支座@成品支座厂家@万向滑动支座_桥兴工程橡胶有限公司 | 宏源科技-房地产售楼系统|线上开盘系统|售楼管理系统|线上开盘软件 | 砂尘试验箱_淋雨试验房_冰水冲击试验箱_IPX9K淋雨试验箱_广州岳信试验设备有限公司 | 播音主持培训-中影人教育播音主持学苑「官网」-中国艺考界的贵族学校 | 品牌设计_VI设计_电影海报设计_包装设计_LOGO设计-Bacross新越品牌顾问 | 阀门智能定位器_电液动执行器_气动执行机构-赫尔法流体技术(北京)有限公司 | 陕西自考报名_陕西自学考试网 | 北京律师咨询_知名专业北京律师事务所_免费法律咨询 | 天津电机维修|水泵维修-天津晟佳机电设备有限公司 | 深圳美安可自动化设备有限公司,喷码机,定制喷码机,二维码喷码机,深圳喷码机,纸箱喷码机,东莞喷码机 UV喷码机,日期喷码机,鸡蛋喷码机,管芯喷码机,管内壁喷码机,喷码机厂家 | 万家财经_财经新闻_在线财经资讯网 | 铜镍-康铜-锰铜-电阻合金-NC003 - 杭州兴宇合金有限公司 | 亮化工程,亮化设计,城市亮化工程,亮化资质合作,长沙亮化照明,杰奥思【官网】 | 武汉画册印刷厂家-企业画册印刷-画册设计印刷制作-宣传画册印刷公司 - 武汉泽雅印刷厂 | 电动葫芦|防爆钢丝绳电动葫芦|手拉葫芦-保定大力起重葫芦有限公司 | 流程管理|流程管理软件|企业流程管理|微宏科技-AlphaFlow_流程管理系统软件服务商 | Q361F全焊接球阀,200X减压稳压阀,ZJHP气动单座调节阀-上海戎钛 | 南京交通事故律师-专打交通事故的南京律师 | 深圳3D打印服务-3D打印加工-手板模型加工厂-悟空打印坊 | 双相钢_双相不锈钢_双相钢圆钢棒_双相不锈钢报价「海新双相钢」 双能x射线骨密度检测仪_dxa骨密度仪_双能x线骨密度仪_品牌厂家【品源医疗】 | 皮带式输送机械|链板式输送机|不锈钢输送机|网带输送机械设备——青岛鸿儒机械有限公司 | 橡胶电子拉力机-塑料-微电脑电子拉力试验机厂家-江苏天源 |