On Sunday, 21 September 2014 at 03:28:03 UTC, Mike wrote:
I suggest the compiler insert calls to whatever "lifetime
events" may cause an increment/decrement. Then, the druntime
can provide the implementation.
I believe with these runtime hooks in place platform-specific
optimizations and even alternative memory managers can be
experimented with.
Your post gave me an idea already, so far we've only been
focusing on Throwable, however... the solution for Error:s and
Exception:s is actually asymmetric!
For the vast majority of applications the best possible
implementation for Error:s is to simply leak the memory, this is
definitely not true for Exceptions(but it could be true for a
small subset of applications, short-lived tools).
Daniel