Skip to main content
Back

Motoko update May 17, 2023

by Kento Sugama

Z0zMQPRKVIaK7jX1WCzBxbK7DNGYjXBoWlMMrpIDSPqavL4W9hlRZqqqYCOEbdnC4EBkqTzFWg7c8iUig_bERsDstWcZSbvzdYWJLnGg0GrhTRAWrX96N-tm5DgMsZD21bEJvxuakLrszCG3Rpr7mXk|690x388

Hey Motoko developers! 👋

Welcome back to the latest Motoko update post! If you happened to miss our previous update, you can catch up here. We discussed a new Bitcoin hackathon for ICP and the VSCode candid features.

Today, we’re excited to discuss a beta test for the new incremental GC! If you want to test out the full usage of the Motoko heap then keep reading!

IluNt1_OGByxGCHdsyEM-a9NnJq8Y3-SVdbsj0M5kof_MOF2Hyc9cqsg8UMd6AYBDUBFswbyG_eE18Shcf4_ASPIsZ8QM9L3GpKgXtwBtBTmW3N7cku99sihkTinrxCygAWjxSGpK_9CnFI5Sx3o86Y|690x306

Incremental Garage Collector: Beta Release!

A new, powerful garbage collector, the incremental GC, has been released for beta-testing with version 0.9.0 of Motoko! The biggest impact of the incremental GC is that it enables heap usage in Motoko up to the full 4GB limit. While the existing GCs are unable to collect the whole heap due to the instruction limit per message, the new GC distributes its work across multiple messages when needed. Using evacuation-compaction based on forwarding pointers, the GC guarantees limited short pauses in all phases and is comparable to the most modern and advanced GCs used in other languages (e.g. Java). The GC’s scalability would also be a key enabler when moving Motoko to a 64-bit heap space in the future. Based on our GC benchmark, the incremental GC allows allocating up to 3x more heap space while consuming around 3-16% less cycles on average compared to the other GCs available in Motoko. For the moment, the incremental GC is only intended for beta testing and can be explicitly activated by the —incremental-gc compiler flag. You can enable the feature in dfx.json like so:

{
“canisters”: {
“my_dapp”: {
“main”: “src/my-dapp.mo”,
“type”: “motoko”,
“args” : “--incremental-gc”
},
},
}

Please let us know of any feedback and special shoutout to @luc-blaeser for leading and building out this large and complex feature! More information on the incremental GC can be found here.

'Til next time!

Keep building, and stay tuned for more updates! – DFINITY Languages team