List of Phobos functions that allocate memory?

Jakob Ovrum jakobovrum at gmail.com
Sat Feb 8 03:33:51 PST 2014


On Saturday, 8 February 2014 at 11:27:27 UTC, Jonathan M Davis 
wrote:
> On Saturday, February 08, 2014 11:17:25 Jakob Ovrum wrote:
>> On Saturday, 8 February 2014 at 11:05:38 UTC, Dmitry Olshansky
>> wrote:>
>> 
>> > If both are thread-local and cached I see no problem 
>> > whatsoever.
>> > The thing is the current "default" of creating exception is
>> > AWFUL.
>> > And D stands for sane defaults and the simple path being good
>> > last time I checked.
>> 
>> How is it not a problem? XException's fields (message, location
>> etc) would be overwritten by the latest throw site, and its
>> `next` field would point to itself.
>
> Then we have multiple of them, or we new up another one when a 
> second one is
> needed. Even if it were only the first exception which avoided 
> the allocation,
> it would be a big gain, and in most cases, you're only going to 
> get a single
> exception, or the exceptions will be of different types.
>
> - Jonathan M Davis

Yes, I'm sure there is a cool solution, I'm just pointing out 
that it's not as simple as statically allocating.

I think it would be a nice exercise to compose such a solution 
with std.allocator.


More information about the Digitalmars-d mailing list