Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-11

Debugging ancient heap allocation

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mark Morgan Lloyd

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]

Reply by email