I'm studying the various implementation of `get_password` in this file:
# minimal.nim
type Wrapper = object
password: int
proc `=destroy`*(self: var Wrapper) =
echo "=destroy(", self.password, ")"
proc `=sink`*(dest: var Wrapper, source: Wrapper) =
Thanks, all. I'll go through these one by one.
> Just `var mem = create int` should do. `--gc:none` memory is never freed.
Using this program:
var mem = create int
mem = nil
Run
and compiling with `nim compile --gc:none leak.nim`, I still do **not** get a
memory
I am trying to force Nim to leak memory to better understand the memory model.
>From my understanding, the following two programs are identical.
#include
int main() {
int *x = malloc(sizeof(int));
x = 0;
}
Run
var mem: ptr int = c
This is my first few hours working with Nim. On my Debian machine with Linux
5.7, the following Nim file compiles successfully:
import rlocks
var x: RLock
x.initRLock()
echo $tryAcquire(x) # prints out "true"
Run
but the following fails to compile: