src/pylib/Lib/gc

Search:
Group by:
Source   Edit  

Lib/gc

Nim's Memory Management

Since Nim 2.0, ORC becomes the default mm (memory management). In ORC, only a cycle collector will runs at runtime, so enable and disable only affect this cycle collector, a.k.a. collect for objects that not causes cycle cannot be disabled in runtime, as it's determined at compile-time, namely by ARC.

Document for Nim's mm.

Python's gc is similar with Nim's `refc` mm, which is default for Nim 1.x

As Nim's mm is so different from Python's gc, only a few APIs of gc can be ported to Nim.

Consts

GcCollectResult = 0
Result of collect Source   Edit  

Procs

proc collect(): int {.discardable, ...raises: [], tags: [RootEffect], forbids: [].}
Hint: Do not use the result. As there is no way to get the number of gc-ed objects current implement always returns GcCollectResult
Source   Edit  
proc disable() {....raises: [], tags: [], forbids: [].}
Source   Edit  
proc enable() {....raises: [], tags: [], forbids: [].}
Source   Edit