Signals and Slots

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Thu Nov 2 12:28:18 PST 2006


Walter Bright wrote:
> Sean Kelly wrote:
>> Walter Bright wrote:
>>> http://www.digitalmars.com/d/std_signals.html
>>>
>>> And that, hopefully, is that.
>>
>> Nice work!  In skimming the code, one thing jumped out at me:
>>
>> signals.d:171: len += len + 4;
>>
>> I think this should be: len += 4;
>>
>> Or actually: len += (void*).sizeof;
> 
> No, that is as intended. It's using a power of 2 allocation method. 
> Also, the sizeof thing is taken care of by the call to calloc/realloc.

Then it's massively over-allocating. Note that it performs a call to 
calloc/realloc *every single time* the function is called. It (more 
than) doubles the length and sets the last element to the new slots.



More information about the Digitalmars-d mailing list