blob: 2ed54bd0b350c5c84d65287cefebbd7a2a5ca486 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
// license:GPL-2.0+
// copyright-holders:Couriersud
/*
* palloc.c
*
*/
#include "pconfig.h"
#include "palloc.h"
#if (PSTANDALONE)
#include <stdlib.h>
#include <xmmintrin.h>
class pmemory_pool
{
public:
pmemory_pool() {}
};
static pmemory_pool sppool;
pmemory_pool *ppool = &sppool;
void* operator new(std::size_t size, pmemory_pool *pool) throw (std::bad_alloc)
{
//printf("here new\n");
return palloc_raw(size);;
}
void operator delete(void *ptr, pmemory_pool *pool)
{
//printf("here delete\n");
if (ptr != NULL)
pfree_raw(ptr);
}
void *palloc_raw(const size_t size)
{
return _mm_malloc(size, 64);
}
void pfree_raw(void *p)
{
_mm_free(p);
}
#endif
|