as we know, string in nim is value type, but i do not know the type of cstring. 
so i wrote a snippet:
    
    
    var y = "abc"
    let z = cstring(y)
    y.add("d")
    
    # when mm:arc
    # assert y == "abcd"
    # assert z == cstring"abc"
    
    # when mm:refc
    assert y == "abcd"
    assert z == cstring"abcd"
    
    
    Run

when mm == refc, it's like a ref or ptr; but when mm == arc, it's like a value 
type; i was so confused. thanks for help!

ps: this question was originated from [this 
pr](https://github.com/daniel-j/nim-mpv/pull/1) that says there is a memory 
leak with cstring.

Reply via email to