InvalidMemoryOperationError@(0)
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Nov 17 14:40:36 PST 2014
On 11/17/14 5:19 PM, Vladimir Panteleev wrote:
> On Monday, 17 November 2014 at 16:40:18 UTC, ketmar via
> Digitalmars-d-learn wrote:
>> On Mon, 17 Nov 2014 15:41:25 +0000
>> Andre via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com> wrote:
>>
>>> ~this()
>>> {
>>> foreach(cp; this._columns)
>>> {
>>> }
>>> }
>> don't do that in destructors. `_columns` field can be already collected
>> by GC.
>
> Last I checked, the GC finalizes all dead objects before freeing them.
The GC is not guaranteed to finalize them all before freeing them all.
I would not count on that property -- even if it's currently true.
Expect that any GC-allocated memory in your dtor is invalid except for
the memory of the object itself.
-Steve
More information about the Digitalmars-d-learn
mailing list