Sources Pipelines Documentation

Allocators  
mallocator.hpp
1 // Copyright (c) 2016 Lukasz Laszko
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 #pragma once
6 
7 #include "memory_block.hpp"
8 
9 namespace boost { namespace memory {
10 
15 {
16 public:
25  static mallocator* self_allocate();
26 
36  memory_block allocate(std::size_t size);
37 
43  void deallocate(memory_block& block);
44 
50  bool owns(memory_block& block);
51 };
52 
53 } }
54 
55 #include "mallocator.ipp"
56 
bool owns(memory_block &block)
Checks if the block has been allocated with this allocator.
Definition: mallocator.ipp:42
void deallocate(memory_block &block)
Deallocates memory block using free.
Definition: mallocator.ipp:36
static mallocator * self_allocate()
Allocates an instance of mallocator on the heap.
Definition: mallocator.ipp:16
An allocator backed by malloc and free system calls.
Definition: mallocator.hpp:14
memory_block allocate(std::size_t size)
Allocates a memory_block using malloc.
Definition: mallocator.ipp:27
Represents an allocated memory block.