Hey def_pri_pub, yes, I know your article. It's been a great help to get 
started, thanks for that!

When I first tried to implement hot loading in Nim a couple of months ago I 
based it on your article, however, I decided to not use threading and not to 
call the compiler from within the script. I then observed seemingly random 
crashes at heap allocations (using new) that are being done in the code of the 
lib file. I learned that these problems are caused by the runner binary and the 
lib using individual instances of the GC and that I had link both against 
nimrtl for them to share one instance (at least that's my understanding of it). 
Indeed that stabilized the allocations, but the issue described in my initial 
posting triggered by re/deallocations once the lib instance has been swapped 
out popped up instead.

With your implementation, I'd be back at the unstable allocations again since 
you do not link against nimrtl. And if you did, you couldn't use threading any 
longer since nimrtl still can't handle that afaik.

If I'd like to confirm the issue, I uploaded the files I tested with:

[https://github.com/Serenitor/hotnim/tree/master/def_pri_pub](https://github.com/Serenitor/hotnim/tree/master/def_pri_pub)

There's a loop in the lib code that allocates stuff, and it always crashes for 
me on the 16th iteration. It may be different on other systems though.

Reply via email to