[fpc-pascal] Is such memorystatisticspossible?

Max Vlasov max.vlasov at gmail.com
Mon Aug 22 15:28:23 CEST 2011


On Mon, Aug 22, 2011 at 4:08 PM, Ludo Brands <ludo.brands at free.fr> wrote:
>
>
> Right. Statistically, the smaller the stack you look at, the less falls positives you get.
>
> One reason for false positives is also that local variables aren't initialised. Procedures declaring local variables like buf:array [0..1000] of char; can cause a lot of false positives since the stack space used by the array can contain return addresses of previously excuted functions. Here the stack unwinding should help a lot, once it works.
>

Never thought about this, but looks like local data described by you
is a very natural source of false positives :). Returning to the stack
frames, can we assume stack frames is just a linked list starting the
current ebp and the return address is always the previous entry on the
stack? I could not check this in lazarus cpu window (I could not find
stack view) but in Delphi the rule seems to work. Hmm... except for
short procedures not using local variables at all.On the other side,
if some of the sub-functions are bypassed due to the absence of the
stack frame, it would be better than false positives.

Max



More information about the fpc-pascal mailing list