GC is reclaiming live objects

deadalnix deadalnix at gmail.com
Thu Oct 11 03:52:38 PDT 2012


Le 11/10/2012 12:39, Walter Bright a écrit :
> On 10/10/2012 9:43 AM, deadalnix wrote:
>> And I don't use C stuff in the application. I don't explicitly free
>> anything and
>> use the last version of D.
>>
>> Obviously, the problem isn't easy to reproduce in a small program, But
>> I get
>> consistent crash in some test cases.
>>
>> So, What am I supposed to do now to investigate the issue ?
>
> These kinds of issues can be hard to debug.
>
> First off, this is the first report I've heard in years that the GC is
> reclaiming live objects. So, my first thought is some other memory
> corruption is happening in your program.
>

Actually, I have a memory corruption. When trying to debug it, I noticed 
that the if I disable the GC, the memory corruption didn't happened 
anymore. Some more investigation lead me to conclude that the GC was 
reclaiming live memory.

This is the first time I notice that, so indeed, I'm as surprised as you.

> My second thought is to make sure all the compiler checks are turned on
> - don't use -release. Try to use @safe.
>
> The gc has several debugging versions you can uncomment. These can
> generate a blizzard of data, but sometimes that's the last resort.
>

I'm currently playing with that.

> Make sure you don't have escaping references to a function's stack
> frame. These aren't detected by the compiler/runtime, and will cause
> horrible corruption problems.
>

Can you elaborate on that ? It may really be the problem as I use 
closures quite a lot.


More information about the Digitalmars-d mailing list