On Monday, 8 September 2014 at 15:55:53 UTC, monarch_dodra wrote:
A particularly relevant example of this issue is `RefCounted`: This struct uses malloc to ref count an object, give a deterministic life cycle, and avoid the GC. Yet, since malloc can fail, it does this:
_store = cast(Impl*) enforce(malloc(Impl.sizeof));
Can you see the issue? This object which specifically avoids using the GC, end up NOT being @nogc.

Although it's tangential to the issue at large, this particular code is wrong anyway. It should be using `onOutOfMemoryError` (which should be @nogc), otherwise the allocation of the exception is likely to fail just as `malloc` did.

Reply via email to