Select one of the symbols to view example projects that use it.
 
Outline
#define INCLUDED_tlsf
#include <assert.h>
#include <stddef.h>
#include <stdbool.h>
tlsf_t
pool_t
tlsf_create(void *, size_t);
tlsf_create_with_pool(void *, size_t, size_t);
tlsf_destroy(tlsf_t);
tlsf_get_pool(tlsf_t);
tlsf_add_pool(tlsf_t, void *, size_t);
tlsf_remove_pool(tlsf_t, pool_t);
tlsf_malloc(tlsf_t, size_t);
tlsf_memalign(tlsf_t, size_t, size_t);
tlsf_memalign_offs(tlsf_t, size_t, size_t, size_t);
tlsf_malloc_addr(tlsf_t, size_t, void *);
tlsf_realloc(tlsf_t, void *, size_t);
tlsf_free(tlsf_t, void *);
tlsf_block_size(void *);
tlsf_size(tlsf_t);
tlsf_pool_overhead();
tlsf_alloc_overhead();
tlsf_fit_size(tlsf_t, size_t);
tlsf_walker
tlsf_walk_pool(pool_t, tlsf_walker, void *);
tlsf_check(tlsf_t);
tlsf_check_pool(pool_t);
tlsf_check_hook(void *, size_t, bool);
Files
loading...
SourceVuESP-IDF Framework and ExamplesESP-IDFcomponents/heap/tlsf/include/tlsf.h
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * SPDX-FileCopyrightText: 2006-2016 Matthew Conte * * SPDX-License-Identifier: BSD-3-Clause *//* ... */ #ifndef INCLUDED_tlsf #define INCLUDED_tlsf #include <assert.h> #include <stddef.h> #include <stdbool.h> #if defined(__cplusplus) extern "C" { #endif /* tlsf_t: a TLSF structure. Can contain 1 to N pools. */ /* pool_t: a block of memory that TLSF can manage. */ typedef void* tlsf_t; typedef void* pool_t; /* Create/destroy a memory pool. */ tlsf_t tlsf_create(void* mem, size_t max_bytes); tlsf_t tlsf_create_with_pool(void* mem, size_t pool_bytes, size_t max_bytes); void tlsf_destroy(tlsf_t tlsf); pool_t tlsf_get_pool(tlsf_t tlsf); /* Add/remove memory pools. */ pool_t tlsf_add_pool(tlsf_t tlsf, void* mem, size_t bytes); void tlsf_remove_pool(tlsf_t tlsf, pool_t pool); /* malloc/memalign/realloc/free replacements. */ void* tlsf_malloc(tlsf_t tlsf, size_t size); void* tlsf_memalign(tlsf_t tlsf, size_t align, size_t size); void* tlsf_memalign_offs(tlsf_t tlsf, size_t align, size_t size, size_t offset); void* tlsf_malloc_addr(tlsf_t tlsf, size_t size, void *address); void* tlsf_realloc(tlsf_t tlsf, void* ptr, size_t size); void tlsf_free(tlsf_t tlsf, void* ptr); /* Returns internal block size, not original request size */ size_t tlsf_block_size(void* ptr); /* Overheads/limits of internal structures. */ size_t tlsf_size(tlsf_t tlsf); size_t tlsf_pool_overhead(void); size_t tlsf_alloc_overhead(void); /** * @brief Return the allocable size based on the size passed * as parameter * * @param tlsf Pointer to the tlsf structure * @param size The allocation size * @return size_t The updated allocation size *//* ... */ size_t tlsf_fit_size(tlsf_t tlsf, size_t size); /* Debugging. */ typedef bool (*tlsf_walker)(void* ptr, size_t size, int used, void* user); void tlsf_walk_pool(pool_t pool, tlsf_walker walker, void* user); /* Returns nonzero if any internal consistency check fails. */ int tlsf_check(tlsf_t tlsf); int tlsf_check_pool(pool_t pool); /** * @brief Weak function called on every free block of memory allowing the user to implement * application specific checks on the memory. * * @param start The start pointer to the memory of a block * @param size The size of the memory in the block * @param is_free Set to true when the memory belongs to a free block. * False if it belongs to an allocated block. * @return true The checks found no inconsistency in the memory * @return false The checks in the function highlighted an inconsistency in the memory *//* ... */ __attribute__((weak)) bool tlsf_check_hook(void *start, size_t size, bool is_free); #if defined(__cplusplus) }{...}; #endif /* ... */ #endif
Details