A freeware heap
We were chasing memory problems through the STL, and shared memory
segments, and strange places that the debugger wouldn't go. I got so
frustrated by this that I wrote my own heap that I could
validate and instrument.
We never used it. The next morning, we took a different approach and
all the problems went away.
Here's the code. Maybe someone will find it useful.
- A straight
- Doubly-linked list of blocks
- First-fit clock search
- Extensive integrity checking and diagnostics
- C++ implementation
If you need routines like
you can build them on top of
The implementation is simple and low-performance.
Nonetheless, it is probably adequate for many applications.
You could wrap the
.h file in an
block to get a C interface.
Porting the implementation down to straight C would be tedious,
Copyright 1999 by Steven W. McDougall.
This code is freeware.
It may be copied/modified/redistributed without restriction.
Steven W. McDougall /
1999 May 25