Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: jg@crl.dec.com (Jim Gettys)
Subject: Re: strange malloc -- fragmentation ?
Date: 23 Feb 1994 13:39:42 GMT	[thread overview]
Message-ID: <2kfmau$ot@quabbin.crl.dec.com> (raw)
In-Reply-To: 2kelld$snu@gap.cco.caltech.edu

In article <2kelld$snu@gap.cco.caltech.edu>, sancho@quixote.gps.caltech.edu (Ignotum per ignotius) writes:
> 
> DEC ALPHA 3000/400 OSF1.3(a)
> 
> 
> I wonder if anyone can clear up a point I that has been bothering me.
> I am allocating memory to a large number of arrays. I know the maximum
> size of each array in advance & previously used this to malloc some
> space in advance. To save space I then decided to calculate the true size,
> and allocate only what's needed. This ought to give a 50% saving but 
> actually falls well short of this. I guage this by the RSS increase 
> after the malloc's and by the maximum size of the process I can run on the
> machine. That IBM RS6000 I just experimented with has no such difficulties !
> 
> What's happening, is it an alignment/fragmentation question or something
> else. Is there a simple fix ?  This is not a time-critical element of my
> code.

The malloc in DEC OSF 1.2 and 1.3 is a Berkeley power-of-two allocator (as I 
remember), and if you happen to allocate near a power of two number of bytes,
rounds up to the next power of two, causing a near factor of two of memory usage
for allocations of this size.  This algorithm is very fast.

OSF 2.0 and later implement a new malloc algorithm, which on average is as fast
as the old algorithm, but as memory efficient as the (typically) slower algorithms
found on other vendor's systems. John Detreville at Digital's Systems Research 
Center did alot of work developing and tuning it.  You get your cake and 
can eat it too.

Remember however, that if your arrays have pointers, you may be needing more
memory for them (64 bits rather than 32 bits).  This won't change.

So the answer is "fixed in 2.0".
			- Jim

-- 
Digital Equipment Corporation
Cambridge Research Laboratory


  reply	other threads:[~1994-02-23 13:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-02-23  4:22 strange malloc -- fragmentation ? Ignotum per ignotius
1994-02-23 13:39 ` Jim Gettys [this message]
1994-02-23 23:17   ` John Hascall
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox