[fpc-pascal] Debugging ancient heap allocation

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Mon Nov 21 09:27:16 CET 2011


Is it possible to use heaptrc to determine whether a pointer refers to a 
valid block on the heap, so that erroneous disposes can be silently 
ignored? Alternatively, is there an easy way of scrubbing heap when 
allocating and deallocating?

Out of curiosity, I'm looking at some 1970s code written using CDC 
Pascal. By today's standards it's pretty horrid- lots of new() and 
dispose() with almost all state in global variables, according to 
valgrind it appears to be releasing blocks that have never been 
allocated and my suspicion is that the original authors didn't realise 
they had a problem.

This isn't particularly important, if it looks like something useful 
I'll rewrite anyway. But I'd prefer to have this even partly functional 
first.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list