6#ifndef BITCOIN_SUPPORT_ALLOCATORS_SECURE_H
7#define BITCOIN_SUPPORT_ALLOCATORS_SECURE_H
20 using base = std::allocator<T>;
21 using traits = std::allocator_traits<base>;
32 template <
typename Other>
struct rebind {
36 T *
allocate(std::size_t n,
const void *hint = 0) {
37 T *allocation =
static_cast<T *
>(
40 throw std::bad_alloc();
void free(void *ptr)
Free a previously allocated chunk of memory.
void * alloc(size_t size)
Allocate size bytes from this arena.
static LockedPoolManager & Instance()
Return the current instance, or create it once.
void memory_cleanse(void *ptr, size_t len)
Secure overwrite a buffer (possibly containing secret data) with zero-bytes.
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
secure_allocator< Other > other
std::allocator_traits< base > traits
typename traits::const_pointer const_pointer
typename traits::value_type value_type
typename traits::pointer pointer
typename traits::difference_type difference_type
secure_allocator(const secure_allocator< U > &a) noexcept
~secure_allocator() noexcept
typename traits::size_type size_type
T * allocate(std::size_t n, const void *hint=0)
secure_allocator() noexcept
secure_allocator(const secure_allocator &a) noexcept
void deallocate(T *p, std::size_t n)