aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorKarsten Schmidt <k@postspectacular.com>2017-07-15 12:12:34 +0100
committerKarsten Schmidt <k@postspectacular.com>2017-07-15 12:25:51 +0100
commitfeef1bae13fa929fef3deda18d676cd25363a50e (patch)
tree1ec97eab26e09fc637f4467c3ae0a55b9bd19cb8 /README.md
parentb838efb48972bc975c609179f261119a5f247a8c (diff)
remove various functions if TA_DISABLE_COMPACT, update ptr casts, update readme
Diffstat (limited to 'README.md')
-rw-r--r--README.md5
1 files changed, 4 insertions, 1 deletions
diff --git a/README.md b/README.md
index 23358ba..e119289 100644
--- a/README.md
+++ b/README.md
@@ -9,12 +9,14 @@ Tiny replacement for `malloc` / `free` in unmanaged, linear memory situations, e
- configurable pointer alignment in heap space
- optional compaction of consecutive free blocks
- optional block splitting during alloc (if re-using larger free'd blocks)
-- tiny, the WASM binary is 1.5KB
+- tiny, the WASM binary is 1.5KB (1.1KB w/ compaction disabled)
## Details
**tinyalloc** maintains 3 linked lists: fresh blocks, used blocks, free blocks. All lists are stored in the same fixed sized array so the memory overhead can be controlled at compile time via the [configuration vars](#configuration) listed below. During initialization all blocks are added to the list of fresh blocks.
+The difference between free & fresh blocks is the former already have an associated heap address and size from previous usage. OTOH fresh blocks are uninitialized and are only used if no existing free blocks satisfy an allocation request.
+
The diagram illustrates the state of having 1 freed block (green), 2 used blocks (red) and the beginning of the fresh (unused) block list:
![memory layout](tinyalloc.png)
@@ -72,6 +74,7 @@ On a 32bit system, the default configuration causes an overhead of 3088 bytes in
**Notes:**
- `TA_ALIGN` is assumed to be >= native word size
+- `TA_BASE` must be an address in RAM (on embedded devices)
- `TA_HEAP_START` is assumed to be properly aligned
If building in debug mode (if `TA_DEBUG` symbol is defined), two externally defined functions are required: