Botan 3.4.0
Crypto and TLS for C&
locking_allocator.h
Go to the documentation of this file.
1/*
2* Mlock Allocator
3* (C) 2012 Jack Lloyd
4*
5* Botan is released under the Simplified BSD License (see license.txt)
6*/
7
8#ifndef BOTAN_MLOCK_ALLOCATOR_H_
9#define BOTAN_MLOCK_ALLOCATOR_H_
10
11#include <botan/types.h>
12#include <memory>
13#include <vector>
14
15namespace Botan {
16
17class Memory_Pool;
18
20 public:
21 static mlock_allocator& instance();
22
23 void* allocate(size_t num_elems, size_t elem_size);
24
25 bool deallocate(void* p, size_t num_elems, size_t elem_size) noexcept;
26
28
30
32
34
35 private:
36 std::unique_ptr<Memory_Pool> m_pool;
37 std::vector<void*> m_locked_pages;
38};
39
40} // namespace Botan
41
42#endif
static mlock_allocator & instance()
mlock_allocator & operator=(const mlock_allocator &)=delete
bool deallocate(void *p, size_t num_elems, size_t elem_size) noexcept
void * allocate(size_t num_elems, size_t elem_size)
mlock_allocator(const mlock_allocator &)=delete
int(* final)(unsigned char *, CTX *)