A tale of two C's.
Doug Gwyn
gwyn at brl-smoke.ARPA
Fri Apr 29 05:22:06 AEST 1988
In article <474 at bnlux0.bnl.gov> drs at bnlux0.UUCP (David R. Stampf) writes:
>(in one example I didn't need the full generality that malloc
>gave me, since I was always allocating fixed length blocks, so I wrote my own
>that took advantage of the machine that I was running on (Mac) ...
The correct way to do this is to write your own MyAlloc() function
that calls on the library malloc() to obtain big chunks of heap which
it then subdivides. You have no way of knowing what one of the C
library routines may need to malloc(), so it is a mistake to replace
malloc() with one that does not have the full semantics. On unusual
architectures it is a mistake to replace it, period.
More information about the Comp.lang.c
mailing list