new heap manager mmalloc

From: "Ulrich Voss" <voss(at)vocalweb(dot)de>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: new heap manager mmalloc
Date: 1999-01-28 11:06:25
Message-ID: 199901281104.MAA08653@mail.vocalweb.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

FYI regarding the recent performance issues.

This lib is ported to win32. I don't know, how many unixes are
supported. Perhaps it's better to reuse something and not to
reimplementit from scratch. But you are to decide.

forwarded from comp.os.linux.announce

---

mmalloc is a heap manager. It is written from a scratch. Main goals were
accurate RAM consuming and performance. Goals achieved using relatively
new virtual memory mapping techniques (known in UNIX wolrd as mmap ;-) and
AVL trees.

Major advantages of this heap manager:
* Trimming and "no commit". mmalloc immediately (not in Windows
world) releases all deallocated pages to the system. Also all
allocated pages are not commited, because new areas are just mapped
in, still not commited and only user program could commit memory. So
the following rule is real true:
"NO UNUSED MEMORY WILL BE CONSUMED".

* Best-fit. Best-fit strategy was used. As shown in real world
experiments, best-fit proven to be more accurate than first-fit.

* AVL Trees. Primary internal structure used for controlling large
blocks (>256 bytes, tunable). So the time consumed by allocating
new block is proportional to O(log N), where N is the number of memory
fragments. Implementation is in pure C and optimized.

* Small blocks grouped. Small blocks are grouped within pages. This
provides more accurate memory consuming. When doing 100000 times
mmalloc(1) only ~130k of real memory will be allocated.

* Smart alignment. Blocks smaller than MALLOC_ALIGN (tunable)
are not aligned. (typical for i386 are blocks <4 bytes). Other
blocks are aligned by MALLOC_ALIGN.

* Small overhead. For blocks large blocks overhead is 32 bytes. It is
approximately 12.5% for 256 bytes long block. For larger blocks size
of this control structure is ever less noticed. Small blocks are
grouped within one page and resulting overhead is less than
0.2% (8/4096*100).

* Pure ANSI-C. Pure ANSI-C without any extensions was used. So library
should be portable. Only vmm functions are not portable, other library
parts should be.

Visit homepage:

http://www.geocities.com/SiliconValley/Circuit/5426/index.html

Valery

----

Ciao

Ulrich
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Ulrich Vo"3 uvo(at)uvo(dot)do(dot)eunet(dot)de

" As a human being I claim the right
to be widely inconsistent " John Peel

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 1999-01-28 12:01:17 PL/pgSQL mixed case support
Previous Message Marc G. Fournier 1999-01-28 10:06:41 Testing...