You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Initializes the control datastructure. MUST be called prior to any other **tinyalloc** function.
39
39
40
+
| Argument | Description |
41
+
|----------|-------------|
42
+
|`base`| Address of **tinyalloc** control structure, typically at the beginning of your heap |
43
+
|`limit`| Heap space end address |
44
+
|`heap_blocks`| Max. number of memory chunks (e.g. 256) |
45
+
|`split_thresh`| Size threshold for splitting chunks (a good default is 16) |
46
+
|`alignment`| Word size for pointer alignment (e.g. 8) |
47
+
48
+
-`alignment` is assumed to be >= native word size
49
+
-`base` must be an address in RAM (on embedded devices)
50
+
40
51
### void* ta\_alloc(size\_t num)
41
52
42
53
Like standard `malloc`, returns aligned pointer to address in heap space, or `NULL` if allocation failed.
@@ -45,7 +56,7 @@ Like standard `malloc`, returns aligned pointer to address in heap space, or `NU
45
56
46
57
Like standard `calloc`, returns aligned pointer to zeroed memory in heap space, or `NULL` if allocation failed.
47
58
48
-
### bool ta\_free(void *ptr)
59
+
### bool ta\_free(void \*ptr)
49
60
50
61
Like `free`, but returns boolean result (true, if freeing succeeded). By default, any consecutive memory blocks are being merged during the freeing operation.
51
62
@@ -59,24 +70,14 @@ Structural validation. Returns `true` if internal heap structure is ok.
59
70
60
71
| Define | Default | Comment |
61
72
|--------|---------|---------|
62
-
|`TA_ALIGN`| 8 | Word size for pointer alignment |
63
-
|`TA_BASE`| 0x400 | Address of **tinyalloc** control data structure |
64
73
|`TA_DEBUG`| undefined | Trace debug information |
0 commit comments