[fpc-pascal] Heap Tracing
Peter Vreman
peter at freepascal.org
Wed Sep 19 10:13:52 CEST 2001
> > > 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?
There is none yet. I know that the heaptrc unit can use some extensions like:
- Trace only from a start to end instead of everything
- Checking if the heap is still correct every X getmem calls
More information about the fpc-pascal
mailing list