std.signals and malloc

eskimo jfanatiker at gmx.at
Fri Jan 18 03:27:05 PST 2013


The magic comes from the fact, that a signal has weak reference
semantics, which means if you drop all references to the target object,
it won't be kept in memory because of the connected signal, instead the
slot gets de-registered automatically. 

Surprisingly a lot of people seem to be unaware of this very useful and
important characteristic of signals. Probably because of coming from a
C#/Java background instead of a C++ (boost, gtk, QT) background, whose
signals implementations are all weak ref based.

Best regards,

Robert



More information about the Digitalmars-d mailing list