Mail Archives: djgpp-workers/2002/04/14/14:26:32
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 -