Using static immutable Exceptions (or other way for NON-GC exceptions)

Iain Buclaw via D.gnu d.gnu at puremagic.com
Wed Feb 18 06:59:11 PST 2015


On 18 February 2015 at 14:54, Liran Zvibel via D.gnu
<d.gnu at puremagic.com> wrote:
> On Wednesday, 18 February 2015 at 13:07:12 UTC, Iain Buclaw wrote:
>>
>> It may be a better solution to have a static TLS pointer that gets
>> new'd upon thread start.  Perhaps even make it a pre-allocated array
>> so we might be able to get chained exceptions working in GDC runtime.
>>
>> Iain
>
>
> I like the idea of static TLS array that gets initialized at each thread.
> Memory/startup time impact should be minimal, but it will allow throwing
> exceptions without touching the GC.
> Some of our code is very latency sensitive, so we try very hard not to use
> the GC at all in these parts.

Yah.  The only gotcha is if you fill up the chain, and it needs to
realloc/grow the memory.  Would only ever happen if you have deep
levels of try { } catch(e) { throw e; }  though....

Iain


More information about the D.gnu mailing list