@giaco:

What you are missing is that things that are allocated globally aren't 
collected; you need to allocate locally inside a function/proc in order to 
qualify for collection:

You need to declare your test code as follows: 
    
    
    if isMainModule:
      let mem0 = getOccupiedMem()
      proc test() = discard newFoo()
      test()
      GC_fullCollect()
      echo (getOccupiedMem() - mem0)
    
    
    Run

The above completely works for normal GC, and with Arc/Orc works for case 1 and 
3, doesn't call the destructor for case 0, and generates a compiler error for 
case 2 for both Arc and Orc, this with Nim version 1.4.8 up to devel latest.

Reply via email to