Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Re: Doug Lea's malloc adapted for 64bit, needs testing
@ 1996-06-07 15:42 David Mosberger-Tang
  0 siblings, 0 replies; 2+ messages in thread
From: David Mosberger-Tang @ 1996-06-07 15:42 UTC (permalink / raw)


>>>>> On Fri, 7 Jun 1996 17:32:09 +0200, Wolfram Gloger <Wolfram.Gloger@Dent.MED.Uni-Muenchen.DE> said:

  Wolfram> Why do this ?  I don't know which malloc version you're
  Wolfram> using in alpha-libc, but if it's GNU malloc or (worse)
  Wolfram> derived from the old BSD code, there is a lot to gain from
  Wolfram> using Doug's version.  It is by far the most
  Wolfram> space-efficient malloc implementation that I know of.  It
  Wolfram> excels in particular at dealing with widely varying
  Wolfram> allocation size distributions, showing little fragmentation
  Wolfram> and returning memory to the system via sbrk(-x) or
  Wolfram> munmap().  On the latest Linux kernels, it also supports
  Wolfram> fast realloc()ation of large chunks via the mremap() system
  Wolfram> call.  I would like to have dl-malloc put into GNU libc,
  Wolfram> but a prerequisite is that it runs on 64bit architectures.

The current libc uses whatever came with libc-4.6.27.  The next libc
will be glibc (with very high probability, at least), so it will use
the GNU malloc.

I'll try your test-program and report back when I've done so.  I'd
like to see it in glibc if it really does improve things.

	--david

^ permalink raw reply	[flat|nested] 2+ messages in thread
* Doug Lea's malloc adapted for 64bit, needs testing
@ 1996-06-07 15:32 Wolfram Gloger
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Gloger @ 1996-06-07 15:32 UTC (permalink / raw)


Hi,

Over the last days, I have hacked Doug Lea's latest malloc version
so that it runs on 64bit-architectures (or so I hope). Unfortunately,
I don't have access to a 64bit machine yet, so I hope someone else
can test it or, if there should be problems, let me test it on a
temporary account.

Why do this ?  I don't know which malloc version you're using in
alpha-libc, but if it's GNU malloc or (worse) derived from the old BSD
code, there is a lot to gain from using Doug's version.  It is by far
the most space-efficient malloc implementation that I know of.  It
excels in particular at dealing with widely varying allocation size
distributions, showing little fragmentation and returning memory to
the system via sbrk(-x) or munmap().  On the latest Linux kernels, it
also supports fast realloc()ation of large chunks via the mremap()
system call.  I would like to have dl-malloc put into GNU libc, but a
prerequisite is that it runs on 64bit architectures.

I hope it does so now.  There is a catch though, because with
sizeof(void*)=8 and sizeof(size_t)=4 the minimum chunk size is 24bytes
(compared to 16bytes on a 32bit arch), so the worst-case overhead
becomes 20bytes rather than 12 (the normal overhead for larger chunks
remains only 4bytes).  But if you're allocating lots and lots of 4byte
(or smaller) chunks, you should probably be running your own
special-purpose allocator anyway.

You can get the malloc source file from

  ftp://md.dent.med.uni-muenchen.de/pub/wmglo/malloc-2.6.3f-64.c

and a simple testing program, malloc-test.c, is also there (that
is also untested under 64bit, but should work).  As a quick start,
you could compile with

% cc -O -DDEBUG -c malloc-2.6.3f-64.c
        ^^^ to test for bugs (but executes much slower!)
% cc -O malloc-test.c malloc-2.6.3f-64.o -o malloc-test
% ./malloc-test
% ./malloc-test 1000000 33000
                ^^^     ^^^
                ^^^     maximum size of a single allocation
                total number of allocations
etc.

If this works for all sorts of allocation sizes (play with the second
command line parameter to malloc-test), fine.  If not, I'd like to
hear about it (please send me mail as I'm not on the Alpha mailing
lists).  You might also want to link against a different malloc
implementation (such as the one in your libc) and compare the `waste
percentage' figures that `malloc-test' prints.

Regards,
Wolfram.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-06-07 15:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-06-07 15:42 Doug Lea's malloc adapted for 64bit, needs testing David Mosberger-Tang
  -- strict thread matches above, loose matches on Subject: below --
1996-06-07 15:32 Wolfram Gloger

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