Article View: comp.sys.atari.st
Article #33784To malloc or not to malloc (was: Another great quote ... errr, Malloc.)
From: Leo de Wit
Date: Fri, 26 Aug 1988 11:05
Date: Fri, 26 Aug 1988 11:05
30 lines
2112 bytes
2112 bytes
In article <467@uvicctr.UUCP> collinge@uvicctr.UUCP (Doug Collinge) writes:
[some lines deleted]...
>Actually, I've always hated the way unix malloc works; too dangerous, you
>see, someone could easily write all over the links, then all hell breaks
>loose especially in a system with no protection. Why not keep the block
>parameters in tables somewhere else? Maybe even The Kernel could keep them
>in Protected Memory and thus have global memory allocation (and fragmentation).
>I digress...
I *LIKE* the Unix malloc(); it is a flexible and portable memory
allocator, and if you're not stuck with a too bad implementation it can
be pretty fast too (in my shell I use a malloc that resembles the BSD
malloc, it is much faster than the one that comes with my - Lattice C -
compiler, and it does not fragment memory too badly). Having links in
protected memory implies you have to use system calls (which generally
does not speed things up).
The chances of writing over a link in the heap are certainly not
greater than writing over a char array on the stack, which is probably
more dangerous (destroying return addresses & link pointers).
The incorrectness of a destroyed link in malloc *CAN* be checked by the
way; not 100% foolproof but much easier than checking a destroyed stack.
If you have chosen for a system without protection you should not complain
about some part being insecure while leaving the rest alone. I'd rather
have the FAT's and stuff in protected memory; if they get messed up you
really are in trouble (disks unreadable at least).
Leo.
Technical Details
Message-ID:
<765@philmds.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!mcvax!hp4nl!philmds!leoReferences:
<1116@atari.UUCP} <692@auvax.UUCP} <1121@atari.UUCP> <467@uvicctr.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!mcvax!hp4nl!philmds!leo From: leo@philmds.UUCP (Leo de Wit) Newsgroups: comp.sys.atari.st Subject: To malloc or not to malloc (was: Another great quote ... errr, Malloc.) Summary: I like it. Message-ID: <765@philmds.UUCP> Date: 26 Aug 88 11:05:29 GMT References: <1116@atari.UUCP} <692@auvax.UUCP} <1121@atari.UUCP> <467@uvicctr.UUCP> Reply-To: leo@philmds.UUCP (Leo de Wit) Distribution: comp Organization: Philips I&E DTS Eindhoven Lines: 30