Skip to content

Commit 0935f6d

Browse files
committed
buffer: use MempoolInstance as default allocator
Currently we use MempoolHolder as default allocator - it makes all buffers use the same MempoolInstance. This buffer cannot be used in Multi-Threaded scenarios, so let's simply use `MempoolInstance` instead - now each connection will use its own allocator. To reduce memory footprint of each connection, let's set default parameter `M = slab_size / block_size` to 16 to use 256KB slabs by default. Along the way, move a brace to the same line with `Buffer` class name to make it conform to our clang format. Part of #110
1 parent e8c0a6c commit 0935f6d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/Buffer/Buffer.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@ namespace tnt {
5858
* REAL_SIZE - constant determines real size of allocated chunk (excluding
5959
* overhead taken by allocator).
6060
*/
61-
template <size_t N = 16 * 1024, class allocator = MempoolHolder<N>>
62-
class Buffer
63-
{
61+
template <size_t N = 16 * 1024, class allocator = MempoolInstance<N, 16>>
62+
class Buffer {
6463
private:
6564
/** =============== Block definition =============== */
6665
/** Blocks are organized into linked list. */

0 commit comments

Comments
 (0)