Content deleted Content added
Line 232:
Nim supports multiple memory management strategies, including the following:<ref>{{Cite web |title=Nim's Memory Management |url=https://nim-lang.org/docs/mm.html |access-date=2024-07-28 |website=nim-lang.org}}</ref>
* <code>--mm:arc</code> – Automatic [[reference counting]] (ARC) with [[move semantics]] optimizations, offers a shared heap. It offers fully deterministic performance for hard realtime systems.<ref>{{Cite web |title=Introduction to ARC/ORC in Nim |url=https://nim-lang.org/blog/2020/10/15/introduction-to-arc-orc-in-nim.html |access-date=2023-08-17 |website=Nim Programming Language |language=en}}</ref> Reference cycles may cause memory leaks: these may be dealt with by manually annotating <code>{.acyclic.}</code> pragmas or by using <code>--mm:orc</code>.
* <code>--mm:orc</code> – Same as <code>--mm:arc</code> but adds a cycle collector (the "O") based on "trial deletion".<ref>{{Cite web |title=ORC - Vorsprung durch Algorithmen |url=https://nim-lang.org/blog/2020/12/08/introducing-orc.html |access-date=2023-08-17 |website=Nim Programming Language |language=en}}</ref> The cycle collector only analyzes types if they are potentially cyclic
* <code>--mm:refc</code> – Standard deferred [[reference counting]] based [[Garbage collection (computer science)|garbage collector]] with a simple mark-and-sweep backup GC in order to collect cycles. Heaps are thread-local.
* <code>--mm:markAndSweep</code> – Simple [[Mark and sweep|mark-and-sweep]] based [[Garbage collection (computer science)|garbage collector]]. Heaps are thread-local.
|