delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/04/14/14:26:32

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3CB9C9A1.43F376A1@phekda.freeserve.co.uk>
Date: Sun, 14 Apr 2002 19:25:37 +0100
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: Malloc/free DJGPP code
References: <10203180617 DOT AA14307 AT clio DOT rice DOT edu> <3CB7A876 DOT 6BF78A5 AT yahoo DOT com>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

CBFalconer wrote:
[snip]
>     <http://cbfalconer.home.att.net/download/nmalloc.zip>
[snip]
> The realloc performance is, to my mind, quite serious.  So I am
> once again urging people to take a good look and possibly
> incorporate it in 2.04.

I've taken a look at the code now. Most of my comments are about coding style
- please don't take offence!

* I think you could use inline functions rather than macros in some cases. I
think macros are evil, but sometimes necessary. Using inline functions would
make debugging/examination easier. One advantage of using real functions for
the debugging printf's is that you can get gcc to check the arguments you
pass. Also perhaps you could also use 'const int' instead of #defines
sometimes.

* You have a description:

typedef struct memblock {
   struct memblock *prev;
   struct memblock *next;
   /* An allocated block has the next two fields NULL */
   /* A free block has them both non-NULL */
   ulong            sz;                 /* of this memblock */
   struct memblock *nextfree;
   struct memblock *prevfree; /* actually data w/SAVEMEMORY */
...
} memblock, *memblockp;

Should the comment proceeding 'ulong sz' be on the line after 'sz'?

* I think the name for the structure returned by _sysmalloc - _sysquery - is
too generic. Why not call it _sysquery_t? Or is _sysmalloc an API used by some
other libc that we want to be compatible with?

I can't really comment on the effectiveness of the algorithm. I guess the
proof is in the pudding, as they say. I agree with Charles that some
real-world benchmarks would be helpful.

Thanks, bye, Rich =]

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019