Well, I fixed it with: proc fmi2FreeInstance*(comp: ModelInstanceRef) = `=destroy`(comp[]) GC_fullCollect() Run
I hope this helps others. Valgrind says: ==716751== ==716751== HEAP SUMMARY: ==716751== in use at exit: 0 bytes in 0 blocks ==716751== total heap usage: 243 allocs, 243 frees, 459,502 bytes allocated ==716751== ==716751== All heap blocks were freed -- no leaks are possible ==716751== ==716751== For lists of detected and suppressed errors, rerun with: -s ==716751== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) Run So this looks good.