Araq: This is what I got back when I asked my SV compiler vendor about the "client switching stacks" warning in valgrind:
The switching stack warning is coming when xmsim makes the dpi call (or you return). Xmsim doesn’t use a traditional c stack and it confuses valgrind when it makes c calls. You can definitely ignor that.
Not sure why the nim gc would be impacted by the internal way xmsim does its stack. When it calls the dpi you have a normal C stack frame at that point… it confuses valgrind because valgrind is seeing the jumps, etc., and it knows something funky is going on… but your dpi code should be pretty insulated from that unless nim is trapping all mallocs, not just the ones you use, and then is trying to free something it doesn’t own.
so.. the "issue" I have with gc:none is that my terminal gets flooded with warns like:
Warning: 'setLen(result, 1)' uses GC'ed memory [GcMem]