memory allocation

Niels J|rgen Kruse njk at freja.dk
Tue Sep 27 07:25:46 AEST 1988


In article <33422 at cca.CCA.COM>, g-rh at cca.CCA.COM (Richard Harter) writes:
> One point which I feel strongly about is that most allocators use the
> blocks (free and allocated) to hold control information.  I think that
> this is a mistake.  I put all control information in structures in a
> separate node space.  This adds overhead, but it makes life a lot safer.
> Array indexing errors do not damage the allocator.  Free's can be checked
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> for validity.

But then they will damage something else. The consequences of
this may be much more suptle and affect output only without
being fatal. Non-fatal bugs does not make life easier!
Corrupting the allocators overhead information is almost
allways fatal (eventually) and can be checked for with
heapwalkers, to pinpoint the cause. In particular, liberation
with boundary tags gives a heap with a lot of redundant
information that can be compared for consistency. Such a
heapwalker ought to be supplied with allocators that store
overhead information in the heap area.

        Niels J|rgen Kruse
        Stud. Scient. at DIKU (U. of Copenhagen)



More information about the Comp.lang.c mailing list