I hate class destructors with a burning passion
Steven Schveighoffer
schveiguy at gmail.com
Thu Jun 10 11:57:21 UTC 2021
On 6/9/21 11:13 PM, Vladimir Panteleev wrote:
> On Wednesday, 9 June 2021 at 14:01:39 UTC, Steven Schveighoffer wrote:
>> On 6/9/21 7:02 AM, Steven Schveighoffer wrote:
>>> Come to think of it, an InvalidMemoryOperationError should use malloc
>>> instead of GC, then maybe we can get stack traces?
>>
>> I delved into this a bit, trying to see where the GC allocations are
>> happening. There are some functions that are not marked nogc that can be.
>>
>> I got hung up on core.demangle.demangle.
>>
>> It's used here:
>> https://github.com/dlang/druntime/blob/751f5665a31ea0f150d71b22a9852abacc2f61ec/src/core/runtime.d#L830-L865
>>
>
> Would it be possible to just skip demangling in situations where the GC
> is unavailable?
>
> Pasting the output through
> [ddemangle](https://github.com/dlang/tools/blob/master/ddemangle.d)
> isn't hard at all.
>
Yeah, actually, that's a good idea. It's better than no stack trace, and
with GC.inFinalizer, we have the ability to know when we can use
demangle or not in the general case. A further update can fix the
demangler, and then the printouts just get better.
Since this is all part of the traceinfo, just fixing the traceinfo for
that exception (which is custom anyway) is possible for now.
I'll see if I can make a PR.
-Steve
More information about the Digitalmars-d
mailing list