RFC: reference counted Throwable

Johannes Pfau via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 21 02:01:35 PDT 2014


Am Sat, 20 Sep 2014 09:07:20 -0700
schrieb Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org>:

> On 9/20/14, 12:46 AM, Olivier Pisano wrote:
> > If making the GC completely optional is a must, then error
> > handling shouldn't rely on it at all, no? What about completely
> > switching exception handling to RC ? Would it have an impact on
> > memory safety since exeption handling mecanism is somehow
> > "magical code generated by the compiler" ?
> 
> The more I think of it the more sensible this is. Exceptions are 
> unlikely to create cycles, not copied extensively, and are generally 
> short lived. So an RC scheme backed by malloc/free seems to be most 
> appropriate.
> 
> There would be breakage, though: Throwable would not be convertible
> to Object. I wonder what the impact in the real world that would
> cause.
> 
> 
> Andrei
> 

+1, replace it completely with malloc/free.

However, for backwards compatibility malloced exceptions probably still
have to be added as roots to the GC, at least if they refer GC
allocated data. This should be somehow optional however.


More information about the Digitalmars-d mailing list