Re: PATCH: two slab-like memory allocators

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>, Petr Jelinek <petr(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, John Gorman <johngorman2(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: two slab-like memory allocators
Date: 2017-02-21 00:43:46
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-hackers


Attached is v9 of this patch series. This addresses most of the points
raised in the review, namely:

1) change most 'debug' stuff to 'static inline' in memdebug.h

2) fixed and reworded a bunch of comments

3) get rid of the block-level bitmap tracking free chunks

Instead of the bitmap, I've used a simple singly-linked list, using
int32 chunk indexes. Perhaps it could use the slist instead, but I'm not
quite sure MAXALIGN is guaranteed to be greater than pointer.

In any case, this seems to be working reasonably well - it saves a bit
of code (but also made some code slightly more complex). Also, it seems
to be a tad faster than v8 - after repeating the same benchmark as
before, I get these numbers:

master slab-v8 slab-v9
10000 50 28 25
50000 17500 180 160
100000 150000 380 330
200000 ? 750 670

Although the results are quite noisy.


Tomas Vondra
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
0001-move-common-bits-to-memdebug-v9.patch text/x-diff 10.8 KB
0002-slab-allocator-v9.patch text/x-diff 32.1 KB
0003-generational-context-v9.patch text/x-diff 53.6 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2017-02-21 00:49:34 Re: Multivariate statistics and expression indexes
Previous Message Tomas Vondra 2017-02-21 00:27:53 Re: Multivariate statistics and expression indexes