-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmmap_allocator.patch
61 lines (56 loc) · 1.37 KB
/
mmap_allocator.patch
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
diff --git a/mmap_allocator.h b/mmap_allocator.h
index d3cc9d5..719887d 100644
--- a/mmap_allocator.h
+++ b/mmap_allocator.h
@@ -14,7 +14,7 @@ namespace mmap_allocator_namespace
template <typename T, typename A>
class mmappable_vector;
- template <typename T>
+ template <typename T>
class mmap_allocator: public std::allocator<T>
{
public:
@@ -25,8 +25,8 @@ public:
template<typename _Tp1>
struct rebind
- {
- typedef mmap_allocator<_Tp1> other;
+ {
+ typedef mmap_allocator<_Tp1> other;
};
pointer allocate(size_type n, const void *hint=0)
@@ -36,7 +36,8 @@ public:
fprintf(stderr, "Alloc %zd bytes.\n", n*sizeof(T));
}
if (access_mode == DEFAULT_STL_ALLOCATOR) {
- return std::allocator<T>::allocate(n, hint);
+ return std::allocator<T>::allocate(n);
+ //return std::allocator<T>::allocate(n, hint);
} else {
if (n == 0) {
return NULL;
@@ -52,7 +53,7 @@ public:
if (get_verbosity() > 0) {
fprintf(stderr, "pointer = %p\n", the_pointer);
}
-
+
return (pointer)the_pointer;
}
}
@@ -78,7 +79,7 @@ public:
}
}
- mmap_allocator() throw():
+ mmap_allocator() throw():
std::allocator<T>(),
filename(""),
offset(0),
@@ -125,7 +126,7 @@ public:
keep_forever((flags & KEEP_FOREVER) != 0)
{
}
-
+
~mmap_allocator() throw() { }
private: