$ nim -v
    Nim Compiler Version 0.18.1 [Linux: amd64]
    Compiled at 2018-08-20
    git hash: b75808c7d992ea47f8d6abc656b881b2aa0f86de
    active boot switches: -d:release
    
    
    
    Run

I can confirm that there are minimal differences for GC with and without 
-d:release:

I took current gintro, added echo output to this proc:
    
    
    # ~/.nimble/pkgs/gintro-0.4.5/gintro/gobject.nim
    proc finalizeGObject*[T](o: T) =
      g_object_remove_toggle_ref(o.impl, toggleNotify, addr(o[]))
      echo "finalizeGObject"
    
    
    Run

Now for this test program
    
    
    # nim c t0.nim
    import gintro/[gtk, gobject]
    import OS
    
    proc bye(w: Window) =
      mainQuit()
      echo "Bye..."
    
    proc main =
      gtk.init()
      var window = newWindow()
      window.title = "First Test"
      window.connect("destroy", bye)
      var b = newButton("test")
      window.add(b)
      window.showAll
      gtk.main()
    
    main()
    sleep(1000)
    GC_fullcollect()
    sleep(1000)
    echo "done"
    
    
    
    Run

output when compiled with -d:release is
    
    
    $ nim c -r -d:release t0.nim
    
    Bye...
    finalizeGObject
    done
    
    
    
    Run

and without -d:release
    
    
    $ nim c -r t0.nim
    
    Bye...
    finalizeGObject
    finalizeGObject
    done
    
    
    
    Run

I would assume two finalizer calls, for window and button. Maybe the reason for 
difference is timing or gcc optimizations. With destructors it may become more 
deterministic, but I am not sure if destructors can really be used for gintro. 

Reply via email to