[fpc-pascal] Issuchmemorystatisticspossible?

Max Vlasov max.vlasov at gmail.com
Mon Aug 22 20:20:38 CEST 2011


On Mon, Aug 22, 2011 at 6:48 PM, Ludo Brands <ludo.brands at free.fr> wrote:
>>
>> Ludo, the patch looks very promising, I just found one
>> problem. I have a test fragment in my form (in a simple
>> simplest application)
>>
>> procedure TForm1.FormCreate(Sender: TObject);
>> var
>>   a: integer;
>> begin
>>   a:=1;
>>   GetMem(fTest, 1024*1024);
>>   GetMem(fTest2, 1024*1024);
>> end;
>>
>
> The problem is a missing stack frame. The caller (TFORM1_FORMCREATE) has a
> stackframe but the callee (GetMem) doesn't.
>
> In other words: the address below the frame is the address of the caller. To
> find the caller, the callee has to have a stackframe.
>
> Attached a patch for missing stack frames. This doesn't solve all cases but
> most. The const MAXFAILS could be made higher but that is again running the
> risk of getting false positives. The reason for having maxfails is that a
> lot of valid addresses are outside the main program area. Your testcase is
> an example.
>

I see, it makes sense. And this temporal look up with maxfails looks
like decent workaround.

There are some things we discussed to fix and improve. Ludo, Isn't it
better to move the following discussion to the bugtracker inside a new
"feature request" topic. I just suppose there are few readers here
that follow and interested in this discussion :) (CMIIW)

Max



More information about the fpc-pascal mailing list