Nim and memory management
Asked Answered
A

1

7

I keep reading that Nim's memory management is optional, but documenttion seems to be thin on this, the only resources I have found relate mostly to FFI to C, and https://nim-lang.org/docs/gc.html

Is it possible to take control of Nim's memory management short of writing a new GC? Any good resources?

Ambulatory answered 28/6, 2019 at 18:20 Comment(0)
S
6

The only thing you can do to take control over the GC are listed on the docs page you listed. You can control when, and for how long the GC will run. The second option is to completely disable the GC, which allows you to manually manage memory in a more C like fashion with explicit allocations and frees. The third option, which is still very experimental, is called "newruntime" and is outlined here: https://nim-lang.org/araq/ownedrefs.html

Solita answered 29/6, 2019 at 12:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.