MeVisLab Toolbox Reference
mlMemoryAllocator.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2008, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef ML_MEMORY_ALLOCATOR_H
14#define ML_MEMORY_ALLOCATOR_H
15
16#include <cstddef>
17
18#include "../mlMemoryManagerDllExport.h"
19
22typedef void* (*MLAllocationCallback)(size_t size);
23
26typedef void (*MLDeallocationCallback)(void* data);
27
30{
31public:
38
39
41 static void* allocate(size_t size);
43 static void deallocate(void* data);
44
45#ifndef DOXYGEN_SHOULD_SKIP_THIS
46private:
50
51private:
54 static unsigned int _alreadyAllocatedMemory;
55
56#endif
57};
58
59#endif // MLMEMORYALLOCATOR_H_INCLUDED
60
The memory allocator used by the memory manager.
static void * allocate(size_t size)
Allocate memory of the given size. Uses malloc if no allocationCallback was specified.
static void initialize(MLAllocationCallback allocationCallback, MLDeallocationCallback deallocationCallback)
Initializes the memory allocator.
static void deallocate(void *data)
Deallocate memory. Uses free if no deallocationCallback was specified.
void *(* MLAllocationCallback)(size_t size)
The callback function type for allocating memory of a certain size.
void(* MLDeallocationCallback)(void *data)
The callback function type for deallocating memory.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.