Re: [cc65] debugmalloc for cc65, v1.0

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2004-07-21 14:25:40
On Wed, Jul 21, 2004 at 01:36:00PM +0200, MagerValp wrote:
> UvB> The inherent block limit (MAXCHUNKS) may be removed by using a
> UvB> single linked list of blocks instead of an array.
>
> But that would require memory allocation, and I thought that that
> might not be such a good idea in a program that's suspected of mucking
> up memory :) The array is fairly small anyway.

No allocations are needed. Currently the layout is like this:

        unsigned size
        unsigned canary
        <memory block>
        unsigned canary

If you make it

        void* next
        unsigned canary
        <memory block>
        unsigned canary

, all you need is a root pointer to walk over all existing blocks. The next
pointer in each block will point to the next one, the last in the list
contains NULL.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Jul 21 14:25:44 2004

This archive was generated by hypermail 2.1.8 : 2004-07-21 14:25:52 CEST