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

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2004-07-17 13:58:46
Hi!

On Fri, Jul 16, 2004 at 03:40:52PM +0200, MagerValp wrote:
> Having, yet again, been bitten by a nasty (yet trivial) malloc/free
> bug, I've updated my debug routines and decided to release them as
> debugmalloc v1.0:

Great! Using malloc on a platform that doesn't have memory protection is quite
adventurous at some times, and your routines will definitely help.

> I'd love some feedback, and patches are especially welcome.

Having a look at the code, I have one comment: The size of a memory block is
already stored in the word below the block. This is undocumented, but I can
make a 

        size_t _heapblocksize (const void* ptr);

function available that returns this word. This would save two bytes per
allocated block, which is not much, but better than nothing. And the function
may help with other problems, too.

The inherent block limit (MAXCHUNKS) may be removed by using a single linked
list of blocks instead of an array.

And, making ptr a register variable will probably speed up the code and make
it smaller.

> I'd also
> like a programming language that managed memory for me, that tracked
> object usage, had good garbage collection, and decent strings so we
> didn't have to deal with this crap. *sigh*

There are such languages, but they're to much for a 6502. At least I think so.
Anyone eager to do a perl port? :-)

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 Sat Jul 17 13:58:50 2004

This archive was generated by hypermail 2.1.8 : 2004-07-17 13:58:59 CEST