<div dir="ltr">Thanks, for the GC stub, that will be great for playing with whether or not a little dmd app crashes after gc_annihilate(true).<div><br></div><div>Did I understand that right?</div><div><br></div><div>R</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 1, 2016 at 6:16 PM, Cauterite via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Monday, 29 August 2016 at 10:42:23 UTC, Alexander Breckel wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
</blockquote>
<br></span>
Because of the poor memory management in the compiler, I included a modified GC-stub when I compiled the frontend as a library, so that it can be used in long-running processes:<br>
<br>
<a href="https://gist.github.com/Cauterite/4eb74347aea040f5d371fb49054e1819" rel="noreferrer" target="_blank">https://gist.github.com/Cauter<wbr>ite/4eb74347aea040f5d371fb4905<wbr>4e1819</a><br>
<br>
You can call gc_annihilate(true) to delete the entire heap.<br>
<br>
Obviously you need to keep the library in a separate DLL with its own runtime, and carefully avoid holding references to GC memory across annihilations.<br>
<br>
This technique is working pretty smoothly for me so far.<br>
<br>
Also to compile it as a DLL you either have to remove main() from mars.d or play games with the C runtime: <a href="https://gist.github.com/Cauterite/b190e62891c773703d0de3a1d99df362" rel="noreferrer" target="_blank">https://gist.github.com/Cauter<wbr>ite/b190e62891c773703d0de3a1d9<wbr>9df362</a><br>
</blockquote></div><br></div>