[fpc-pascal] mysterious crashing, maybe related to setlength

Jonas Maebe jonas.maebe at elis.ugent.be
Sun Sep 6 10:59:15 CEST 2009


On 06 Sep 2009, at 10:16, David Emerson wrote:

> My program is crashing, and I just can't figure out why. Heaptrc has
> given me this rather cryptic info:
>
> Marked memory at $B79BA208 invalid
> Wrong signature $000020D8 instead of 8E1C71B6

It means that you probably have a buffer overrun somewhere.

> Using lazurus's step-into functionality, I've it down to the line  
> where
> it's crashing -- seems to be crashing upon completion of a function.

At the end of a function, all local variables are finalised. It's  
probably finalising a local dynamic array (possibly the one you  
mention below).

> Alternately, I can get it to make a similar crash on setlength of a
> dynamic array to length 0. (The array has refcount 1.)
>
> I haven't been able to reduce my code to anything reasonable;  
> whenever I
> cut out seemingly irrelevant/unrelated sections, the crashing stops.

Have you tried compiling with range checking on? (-Cr)


Jonas



More information about the fpc-pascal mailing list