@mratsim Oh yes, I tend to forget Nim is garbage-collected as I don't use data 
structures that couldn't use RAII all that much. ^^" But is it really ok to not 
clean the GPU memory object? It seems to me it should always be deallocated but 
I'm not really sure. I ask because finalizers, contrary to destructors, are not 
required to actually be called:
    
    
    type Sth = ref object
    
    proc echoSth(x: Sth) = echo "Sth!"
    
    var a: Sth
    new(a, echoSth)
    # echos nothing
    

As far as I know you need to explicitly demand calling finalizers if you really 
want them to be called:
    
    
    type Sth = ref object
    
    proc echoSth(x: Sth) = echo "Sth!"
    
    var a: Sth
    new(a, echoSth)
    deallocHeap()
    # echos: "Sth!"
    

Reply via email to