new heap manager mmalloc - Mailing list pgsql-hackers
From | Ulrich Voss |
---|---|
Subject | new heap manager mmalloc |
Date | |
Msg-id | 199901281104.MAA08653@mail.vocalweb.de Whole thread Raw |
Responses |
Re: [HACKERS] new heap manager mmalloc
(The Hermit Hacker <scrappy@hub.org>)
|
List | 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) releasesall 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: "NOUNUSED 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 byallocating new block is proportional to O(log N), where N is the number of memory fragments. Implementation is in pureC and optimized. * Small blocks grouped. Small blocks are grouped within pages. This provides more accurate memory consuming. When doing100000 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. Forlarger blocks size of this control structure is ever less noticed. Small blocks are grouped within one page and resultingoverhead 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@uvo.do.eunet.de " As a human being I claim the right to be widely inconsistent " John Peel -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
pgsql-hackers by date: