How to create nogc code?

ag0aep6g via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jul 10 22:40:42 PDT 2016


On 07/11/2016 02:31 AM, Adam Sansier wrote:
> idup uses the gc, I am currently just malloc'ing the string and allowing
> for the memory leak. This is somewhat acceptable given that this code
> should rarely be called and generally only at startup. It will generally
> waste only a few KB of memory.

If you can afford the memory leak, you could probably afford the GC, no?

That section (only called at startup) doesn't seem to be 
performance-critical. It doesn't matter then if the GC does its thing 
during it.

And keep in mind that the GC only collects when an allocation is made. 
So if you never allocate with it again, you're basically in the same 
spot as now: allocated a few KB of memory that never get freed.


More information about the Digitalmars-d-learn mailing list