Dealing with the interior pointers bug

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 21 08:42:22 PDT 2017


On Wednesday, 21 June 2017 at 15:34:15 UTC, TheGag96 wrote:
> Could it ever be fixed?

Easiest: stick `-m64` in your build. While it is somewhat common 
in 32 bit, it is very rare in 64 bit.

This comes from the fact that D's GC is conservative - if it sees 
something that *might* be a pointer, it assumes it *is* a pointer 
and thus had better not get freed.

Of course, the bug here if you do hit it is a relatively benign 
one: it will be a memory leak. So you might be able to live with 
it.

But ketmar and I have done some image work in 32 bit that has hit 
such problems before, since the image arrays can be kinda large. 
In those cases, tweaking the GC or using malloc and free on the 
larger arrays are both solutions. (or, again, recompiling in 64 
bit mode for most people).


More information about the Digitalmars-d-learn mailing list