On Sunday, 9 April 2017 at 03:26:14 UTC, Walter Bright wrote:
The only place a refcounted Throwable is ever created is when the following
statement is in the user code:

    throw new E(string);

object aMemoryLeak;

void someFunc()
{   throw (aMemoryLeak = new Exception("hello world!"));
}

Would the compiler warn about this or make the exception normally garbage collected?

I'm not sure, but perhaps an entirely different syntax would be in place for throwing a refcounted object, so there's no special casing. For example, could a throw statement without the new keyword mean a refcounted throw?


Reply via email to