On exceptions in D
Jonathan M Davis
jmdavisProg at gmx.com
Sun Feb 9 19:09:16 PST 2014
On Monday, February 10, 2014 01:49:40 inout wrote:
> All that wouldn't be a problem if D had ARC for everything,
> including Exception`s.
Well, yes and no. ARC would make it so that your typical exception would be
freed right after you're done with it, which would be great, but given that
those should be fairly rare, and they usually aren't super performance
sensitive, having them be managed by the GC isn't all that big a deal IMHO.
Where it matters is when you would want to avoid allocating when throwing, in
which case, you wouldn't want ARC - or at least you wouldn't care if it was
ARC or managed by the GC - because in that case, you'd be looking to avoid the
allocation cost by pre-allocating the exceptions and reusing them, and at that
point, ARC buys you nothing over the GC except that it avoids having that
memory scanned by the GC on a collection (and ARC could even incur some minor
overhead when it has to do the ref-counting). So, I don't really see ARC as a
solution here - not to the code that's performance-sensitive enough to be
worried about the heap allocation anyway.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list