官术网_书友最值得收藏!

No garbage collection

WebAssembly supports a flat linear memory, which isn't a limitation per se, but requires some understanding of how to explicitly allocate memory to execute code. C and C++ were logical choices for the MVP because memory management is built into the language. The reason why some of the more popular high-level languages such as Java weren't included initially is due to something called garbage collection (GC).

GC is a form of automated memory management wherein memory occupied by objects that are no longer in use by the program is reclaimed automatically. GC is analogous to an automatic transmission on a car. It has been heavily optimized by skilled engineers to operate as efficiently as possible, but limits the amount of control the driver has. Manually allocating memory is like driving a car with a manual transmission. It affords greater control over speed and torque, but misuse or lack of experience can leave you stranded with a severely damaged car. Part of C and C++'s excellent performance and speed can be attributed to the manual allocation of memory.

GC languages allow you to program without having to worry about memory availability or allocation. JavaScript is an example of a GC language. The browser engine employs something called a mark-and-sweep algorithm to collect unreachable objects and free up the corresponding memory. Support for GC languages is currently being worked on in WebAssembly, but it's hard to say exactly when it will be completed.

主站蜘蛛池模板: 满城县| 长春市| 博客| 黑山县| 托克逊县| 平泉县| 抚宁县| 日照市| 阿拉善右旗| 乌兰察布市| 伊宁县| 宿州市| 邮箱| 鄂州市| 平度市| 巴青县| 乌兰察布市| 波密县| 隆昌县| 萝北县| 巧家县| 肃北| 法库县| 晋州市| 昌邑市| 澄江县| 依兰县| 淮阳县| 原阳县| 秭归县| 礼泉县| 手游| 黎城县| 松潘县| 景谷| 温宿县| 剑川县| 尼玛县| 曲松县| 时尚| 平安县|