collectNoStack should be axed
Quirin Schroll
qs.il.paperinik at gmail.com
Tue Apr 23 12:18:34 UTC 2024
On Tuesday, 23 April 2024 at 07:38:25 UTC, cc wrote:
> On Sunday, 21 April 2024 at 19:28:11 UTC, Steven Schveighoffer
> wrote:
>> If they don't get a printout, they post an angry/confused
>> message on the forums saying
>>
>> ### Y U No work GC?
>
> If a user writes a destructor, and that destructor is never
> called sometime after a `new`, then yes, I think "Why isn't the
> GC working?" is a valid and fair question for that user to ask.
> I don't see any way in which that expectation should be
> considered *unreasonable*. If the answer is "No you don't
> understand, the GC internals such that this- that- and the
> other thing- means you can't have guaranteed destructors", then
> I'd say you've failed to make the sale and the customer is
> right to walk away.
I always thought destructors run on GC-allocated objects some
time between the last reference to the object disappears and the
application exits. If you want some cleanup to run promptly after
last reference is gone, a destructor is not the right tool. (You
need reference counting or something like that, if a unique owner
cannot be established.) The destructor not running at all is
really surprising if you allocated the object normally.
More information about the Digitalmars-d
mailing list