Proper way to work around `Invalid memory operation`?

Nemanja Boric via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Sep 26 02:43:02 PDT 2016


On Sunday, 25 September 2016 at 16:07:12 UTC, Matthias Klumpp 
wrote:
> At time, I work around this bug by calling close() manually at 
> the appropriate time, but this feel like a rather poor solution.
>
> Cheers,
>     Matthias

That's not a poor solution, but rather a much better solution if 
you rely on GC to call destructor (which it may or may not do). 
Consider creating few hundreds instances of a class that holds 
several file descriptors and then throw them away in a short time 
(not unusual for tests, say). It is very likely that you'll hit 
file descriptors limits pretty soon.



More information about the Digitalmars-d-learn mailing list