Article View: comp.sys.sun
Article #10956Re: "busted" malloc
From: Dave Jones
Date: Wed, 15 Feb 1989 17:19
Date: Wed, 15 Feb 1989 17:19
34 lines
2220 bytes
2220 bytes
For applications where memory-allocation is critical, I've quit using
malloc "raw". The algorithm the malloc-writers chose may not be at all
suited to your application. But if it is, they might change it next
release, anyway.
I am quite happy with the slow, first fit algorithm on my Sun-3, because
it is stingy with virtual memory. Sorry to hear they are changing it,
although I can understand the rationale.
I have a small collection of memory-allocation routines that I use instead
of using malloc directly. They get large chunks of memory from malloc,
(just as malloc typically gets large chunks from sbrk), and then they
apportion it. They have their own free-lists, etc..
One package allows you to allocate heaps which only dispense one size of
packet. It is a pretty simple package, and using it speeds some programs
up by a factor of 100 on my Sun 3/60. Another package is a virtual stack,
for deallocating memory in the reverse order from the order in which it
was allocated. You get a "mark", which is a virtual pointer to the top of
stack, and later release all memory above the mark. It dispenses
arbitrary size packets. It can show extremely large speed improvements
over regular malloc. Besides, there's the convenience of deallocating all
the packets in one go.
Of course, I also have a stacking package for fixed sized things.
Many of my utility packages, for lists, hash-tables, etc., have their own
specialized memory allocation and deallocation built into them.
I would be interested in trading with others who have similar
uncopyrighted packages.
Dave Jones
sun!megatest!djones
Technical Details
Message-ID:
<1806@goofy.megatest.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-requestReferences:
<8901312116.AA01896@miranda.uucp>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request From: megatest!djones@decwrl.dec.com (Dave Jones) Newsgroups: comp.sys.sun Subject: Re: "busted" malloc Message-ID: <1806@goofy.megatest.UUCP> Date: 15 Feb 89 17:19:50 GMT References: <8901312116.AA01896@miranda.uucp> Sender: usenet@rice.edu Organization: Megatest Corporation, San Jose, Ca Lines: 34 Approved: Sun-Spots@rice.edu Original-Date: 9 Feb 89 22:03:31 GMT X-Sun-Spots-Digest: Volume 7, Issue 156, message 4 of 11