1 //=-- lsan_allocator.h ----------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file is a part of LeakSanitizer.
11 // Allocator for standalone LSan.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LSAN_ALLOCATOR_H
16 #define LSAN_ALLOCATOR_H
17 
18 #include "sanitizer_common/sanitizer_common.h"
19 #include "sanitizer_common/sanitizer_internal_defs.h"
20 
21 namespace __lsan {
22 
23 void *Allocate(const StackTrace &stack, uptr size, uptr alignment,
24                bool cleared);
25 void Deallocate(void *p);
26 void *Reallocate(const StackTrace &stack, void *p, uptr new_size,
27                  uptr alignment);
28 uptr GetMallocUsableSize(const void *p);
29 
30 template<typename Callable>
31 void ForEachChunk(const Callable &callback);
32 
33 void GetAllocatorCacheRange(uptr *begin, uptr *end);
34 void AllocatorThreadFinish();
35 void InitializeAllocator();
36 
37 }  // namespace __lsan
38 
39 #endif  // LSAN_ALLOCATOR_H
40