[fpc-pascal] Heap Tracing

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Sep 19 09:56:11 CEST 2001

On Tue, 18 Sep 2001 17:19:40 +0200
Jonas Maebe <jonas at zeus.rug.ac.be> wrote:

> On dinsdag, september 18, 2001, at 01:01 , Mattias Gaertner wrote:
> > Question 1:
> > I have a nasty bug: an unknown function is overwriting some memory. The 
> > bug appears later in other functions (destroyed heap and objects). For 
> > example: the GetMem allocates memory which partly was never freed.
> > To find the evil function I want to check the complete heap (allocated 
> > mem) from time to time to see when the error appears. I think the 
> > heaptrc unit can add marks at the head and the tail of each allocated 
> > mem and do some little checks every time memory is allocated/freed. But 
> > how can I check ALL structures (allocated+freed memory blocks) at once?
> I think that if you recompile the heaptrc unit with -dEXTRA, this will 
> happen every time you allocate/release memory.
> BTW: I don't know about your second question, but you should 
> "quicktrace" to false if you want more thorough debugging

Thx, it works.
But it is far too slow because I have millions of mem blocks and thus it is not useful for debugging.
If I have a single function to check all allocated/freed mem blocks at once I could binary search the bug.

Somebody knows of such a function?


More information about the fpc-pascal mailing list