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

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

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

      <bdo id='oYqBj'></bdo><ul id='oYqBj'></ul>
  1. <tfoot id='oYqBj'></tfoot>

    1. <small id='oYqBj'></small><noframes id='oYqBj'>

      什么是 JavaScript 垃圾回收?

      What is JavaScript garbage collection?(什么是 JavaScript 垃圾回收?)

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

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

              <bdo id='sD329'></bdo><ul id='sD329'></ul>

                <tfoot id='sD329'></tfoot>
                  <tbody id='sD329'></tbody>
              1. 本文介紹了什么是 JavaScript 垃圾回收?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                什么是 JavaScript 垃圾回收?為了編寫更好的代碼,對于 Web 程序員來說,了解 JavaScript 垃圾收集有什么重要意義?

                What is JavaScript garbage collection? What's important for a web programmer to understand about JavaScript garbage collection, in order to write better code?

                推薦答案

                Eric Lippert 寫了一個 詳細的博客文章不久前關于這個主題(另外將它與 VBScript 進行比較).更準確地說,他寫的是 JScript,這是微軟自己實現的ECMAScript,雖然與 JavaScript 非常相似.我想您可以假設 Internet Explorer 的 JavaScript 引擎的絕大多數行為都是相同的.當然,實現會因瀏覽器而異,但我懷疑您可以采用一些通用原則并將它們應用于其他瀏覽器.

                Eric Lippert wrote a detailed blog post about this subject a while back (additionally comparing it to VBScript). More accurately, he wrote about JScript, which is Microsoft's own implementation of ECMAScript, although very similar to JavaScript. I would imagine that you can assume the vast majority of behaviour would be the same for the JavaScript engine of Internet Explorer. Of course, the implementation will vary from browser to browser, though I suspect you could take a number of the common principles and apply them to other browsers.

                引自該頁面:

                JScript 使用非分代標記和清除垃圾收集器.它像這樣工作:

                JScript uses a nongenerational mark-and-sweep garbage collector. It works like this:

                • 范圍內"的每個變量被稱為清道夫".清道夫可以指一個數字、一個對象、一個字符串,隨便.我們維護一個列表清道夫——變量被移動當他們來的時候進入 scav 名單進入范圍并退出 scav 列表時他們超出了范圍.

                • Every variable which is "in scope" is called a "scavenger". A scavenger may refer to a number, an object, a string, whatever. We maintain a list of scavengers -- variables are moved on to the scav list when they come into scope and off the scav list when they go out of scope.

                時不時的垃圾收集器運行.首先它放了一個在每個對象、變量上標記",字符串等 - 跟蹤的所有內存由 GC.(JScript 使用 VARIANT內部和那里的數據結構有很多額外的未使用的位那個結構,所以我們只設置一個他們.)

                Every now and then the garbage collector runs. First it puts a "mark" on every object, variable, string, etc – all the memory tracked by the GC. (JScript uses the VARIANT data structure internally and there are plenty of extra unused bits in that structure, so we just set one of them.)

                其次,它清除了標記清道夫和傳遞閉包清道夫參考.所以如果一個scavenger 對象引用 anonscavenger 對象然后我們清除非清道夫上的位,以及它所指的一切.(我是在 a 中使用閉包"這個詞和我之前的感覺不同發布.)

                Second, it clears the mark on the scavengers and the transitive closure of scavenger references. So if a scavenger object references a nonscavenger object then we clear the bits on the nonscavenger, and on everything that it refers to. (I am using the word "closure" in a different sense than in my earlier post.)

                此時我們知道所有的仍標記的內存已分配任何人都無法觸及的記憶來自任何范圍內變量的路徑.全部這些對象被指示撕毀自己,這會破壞任何循環引用.

                At this point we know that all the memory still marked is allocated memory which cannot be reached by any path from any in-scope variable. All of those objects are instructed to tear themselves down, which destroys any circular references.

                垃圾回收的主要目的是讓程序員擔心他們創建和使用的對象的內存管理,當然有時也無法避免 - 擁有它總是有益的至少大致了解垃圾收集的工作原理.

                The main purpose of garbage collection is to allow the programmer not to worry about memory management of the objects they create and use, though of course there's no avoiding it sometimes - it is always beneficial to have at least a rough idea of how garbage collection works.

                歷史記錄:答案的早期版本對 delete 運算符的引用不正確.在 JavaScript delete 運算符中刪除對象的屬性,與 C/C++ 中的 delete 完全不同.

                Historical note: an earlier revision of the answer had an incorrect reference to the delete operator. In JavaScript the delete operator removes a property from an object, and is wholly different to delete in C/C++.

                這篇關于什么是 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='iqjNa'></bdo><ul id='iqjNa'></ul>
                          <tbody id='iqjNa'></tbody>

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

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

                        • <legend id='iqjNa'><style id='iqjNa'><dir id='iqjNa'><q id='iqjNa'></q></dir></style></legend>
                          主站蜘蛛池模板: 91欧美 | 欧美网站一区二区 | h视频免费在线观看 | 成人免费视频一区 | 美国av毛片 | 欧美成人a∨高清免费观看 欧美日韩中 | 日本字幕在线观看 | 国产成人免费视频网站高清观看视频 | av手机免费在线观看 | 香蕉国产在线视频 | 91不卡 | av黄色在线| 国产精品色| 青青青伊人 | 日韩亚洲视频在线 | 欧美黑人狂野猛交老妇 | 一区二区三区四区av | 欧美性生活免费 | 日韩高清一区 | 国产伦精品一区二区三区精品视频 | 日韩欧美在线免费观看视频 | 天天操天天怕 | 天天躁日日躁狠狠的躁天龙影院 | 国产精品一区二区欧美黑人喷潮水 | 丁香五月网久久综合 | 欧美日韩一 | 五月婷婷色 | 午夜精品一区二区三区在线 | 日本特黄a级高清免费大片 成年人黄色小视频 | 国产福利在线视频 | 精品久久久久久久 | 欧美久久视频 | 亚洲一区二区三区视频 | 日韩精品一区二区不卡 | 亚洲永久免费 | 日本一本视频 | 中文字幕一区二区三区四区五区 | 黄网站在线播放 | 亚洲首页 | 欧美一级大黄 | 亚洲精品一区中文字幕乱码 |