[fpc-devel]Improvements for heaptrc.pp

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Sep 4 16:28:23 CEST 2002


On Wed, 4 Sep 2002 13:52:51 GMT
Peter Vreman <peter at freepascal.org> wrote:

> > > > 1. getmem_cnt, freemem_cnt, getmem_size, freemem_size, getmem8_size, freemem8_size
> > > should
> > > be readable via functions in the interface. Very useful for optimization.
> > > > 
> > > > 2. QuickTrace = false is very slow, but also very useful. It would be nice to have a
> > > procedure, that can be called at any time, and that does a big check. For example:
> > > > 
> > > > procedure CheckHeap;
> > > > var p: pointer;
> > > > begin
> > > >   QuickTrace:=false;
> > > >   GetMem(p,4);
> > > >   FreeMem(p);
> > > >   QuickTrace:=true;
> > > > end;
> 
> What can be a speed improvement is to have a value that determines how often the whole
> heap is checked. So you can do it only once for each 10 allocations.

Good idea.
This Frequency should be a public variable, so it can be changed at any time.
I use the CheckHeap procedure to binary search heap destructions in programs with millions of allocations. You can imagine, that each heap check costs a lot of time. But with CheckHeap, binary search and of course the speedy fpc, you can track down bugs in minutes, that would cost in other languages days to find.


> Also checkpointer can shall be extended with a possibility to check if the pointer is not
> in one of the freed memory blocks. Together with the keep_released flag it can then be
> used to find dangling pointers.

:)

Who will do it?

Mattias




More information about the fpc-devel mailing list