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

<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="qwawimqqmiuu" 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>

        我可以觸發(fā) JavaScript 的垃圾回收嗎?

        Can I trigger JavaScript#39;s garbage collection?(我可以觸發(fā) 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="qwawimqqmiuu" id='3pK8b'><tfoot id='3pK8b'></tfoot><dl id='3pK8b'><fieldset id='3pK8b'></fieldset></dl></div>
                  本文介紹了我可以觸發(fā) JavaScript 的垃圾回收嗎?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我想觸發(fā) 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?

                  全城的人都在說刪除引用就行了.有人說擦除對象是額外的保證(示例).所以我寫了一個腳本來嘗試書中的每一個技巧,我驚訝地發(fā)現(xiàn)在 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. 創(chuàng)建一個容器,一個數(shù)組,用于保存某種對象.我們將在此處將此容器稱為 Bertil.

                  其中的每個對象,作為 Bertil 中的一個元素,都應將其自己的數(shù)組容器聲明為屬性.該數(shù)組將保存大量字節(jié).我們將調(diào)用 Bertil 的任何元素,對象Joshua.每個 Joshua 的字節(jié)數(shù)組將被稱為 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 [對象數(shù)組] -> Joshua [對象] -> Smith [字節(jié)數(shù)組] -> 未命名 [字節(jié)].

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

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

                  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 上拋出一個刪除操作數(shù).

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

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

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

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

                  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 保存的每個字節(jié).

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

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

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

                  那么發(fā)生了什么?4a4b 的情況下,沒有瀏覽器的垃圾收集器 (GC) 啟動.在 4c 的情況下到 4e,F(xiàn)irefox 確實啟動并展示了一些概念證明.記憶在一分鐘內(nèi)很快被回收.使用當前硬編碼的一些變量作為測試配置的默認值,案例 4f4e 導致 Chrome 掛起,所以我不能在那里得出任何結(jié)論.您可以自由地使用自己的變量進行自己的測試,鏈接將很快發(fā)布.IE 在 4f 和 4e 病例中幸存下來,但他的 GC 像往常一樣死了.出乎意料的是,F(xiàn)irefox 幸存下來但沒有通過 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 分鐘并不能解決問題.并且重新加載整個頁面會導致內(nèi)存占用翻倍.

                  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.

                  我的結(jié)論是我一定在代碼中犯了一個可怕的錯誤,或者你的問題的答案是:不,我們不能觸發(fā) GC.每當我們試圖這樣做時,我們都會受到嚴厲的懲罰,我們應該把頭埋在沙子里.請我鼓勵你繼續(xù),自己嘗試這些測試用例.看看代碼中對細節(jié)的評論.另外,下載頁面并重寫腳本,看看是否可以以更合適的方式觸發(fā) 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

                  這篇關于我可以觸發(fā) JavaScript 的垃圾回收嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調(diào)用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調(diào)用完成)
                  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屋-程序員軟件開發(fā)技術分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內(nèi)容)
                  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="qwawimqqmiuu" 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'>

                            主站蜘蛛池模板: 日本不卡免费新一二三区 | 日韩精品一区二区三区在线观看 | 国产在线拍偷自揄拍视频 | 久久人体视频 | 午夜精品久久久久久久久久久久久 | 一区二区三区四区视频 | 久久久久久国产精品免费免费狐狸 | 国产在线观看福利 | 久久久激情 | 欧州一区二区三区 | 久久久久精 | 成人免费视频在线观看 | 福利一区二区 | 日韩欧美在线观看 | 男人天堂网址 | 黄色大片网站 | 久久国产欧美日韩精品 | 男女视频91| 久久亚洲欧美日韩精品专区 | 亚洲最大看片网站 | 91就要激情 | 欧美另类视频 | 欧美video| 久久免费大片 | 国产欧美日韩在线 | 日韩视频免费看 | 欧美色综合 | 中国免费黄色片 | 亚州无限乱码 | 高清免费在线 | 91久久久久 | 国产小u女发育末成年 | 中文字幕人成乱码在线观看 | 国产日韩一区二区三区 | 国产精品成人一区二区 | av 一区二区三区 | 成人黄色a| 国产日韩精品视频 | 色综合久久天天综合网 | 欧美色欧美亚洲另类七区 | 91在线一区二区三区 |