Debugging InvalidMemoryOperationError

ag0aep6g via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 11 06:11:27 PDT 2016


On 07/11/2016 02:42 PM, Sam wrote:
> #0  0x0000000000670a50 in onInvalidMemoryOperationError ()
> #1  0x000000000068657b in gc.gc.GC.malloc() ()
> #2  0x000000000067a4d2 in _d_newclass ()
> #3  0x0000000000670d53 in _d_assert ()
> #4  0x000000000053d8e2 in
> std.typecons.__T10RefCountedTS4cram8wrappers54__T5RcPtrTS4cram6htslib10cram_sliceS15cram_free_sliceZ5RcPtr7PayloadVE3std8typecons24RefCountedAutoInitializei0Z.RefCounted.__dtor()
> ()
> #5  0x00000000005d39e6 in
> cram.wrappers.__T5RcPtrTS4cram6htslib10cram_sliceS15cram_free_sliceZ.RcPtr.__fieldDtor()
> ()
> #6  0x000000000043a5e4 in cram.wrappers.CramSlice.__fieldDtor() ()
> #7  0x00000000005d4ce2 in
> cram.wrappers.UndecodedSliceRange.__fieldDtor() ()
> #8  0x000000000067c20e in rt_finalize2 ()
> #9  0x000000000068935a in gc.gc.Gcx.sweep() ()
> #10 0x0000000000687a1b in gc.gc.Gcx.fullcollect() ()
> #11 0x0000000000687bae in gc.gc.GC.fullCollectNoStack() ()
> #12 0x000000000067922b in gc_term ()
> #13 0x0000000000679efa in rt_term ()
> #14 0x000000000067a170 in _d_run_main ()
> #15 0x0000000000414278 in main ()
>
> Questions:
>
> * does this suggest that an assert in the destructor of
> std.typecons.RefCounted is trying to allocate memory?

Looks like it. I suppose that means that the assert has failed. 
Otherwise it shouldn't allocate. Allocating in a destructor is what 
usually raises InvalidMemoryOperationError.

The only assert there is this:

https://github.com/dlang/phobos/blob/61a7f2a250962a677aa01495cb342234ddac3a7f/std/typecons.d#L4864

> * if so, is this considered a bug?

Possibly. Would need a smaller test case to make sense of it.


More information about the Digitalmars-d-learn mailing list