> instantiateObject is a wrapped C function That was my guess, and that can not work: I told you that Nim references can only be created my Nim, not by C functions. References are managed pointers, only Nim knows how to created them, and how to destroy them.
When you test your code you should try to use --gc:arc to get the crash immediately and not with a long delay. Or when you use default --gc:refc put in your code a GC_Fullcollect() call to see if it will crash when GC starts.