diff options
author | bfredl <bjorn.linse@gmail.com> | 2022-06-02 09:18:13 +0200 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2022-06-14 14:33:04 +0200 |
commit | 3f5c647de97a424d8a06e85b912ed46cc3ca8298 (patch) | |
tree | ee1eb2d7db29f903f86684cae28107eb2c835b7e /src/nvim/memory.h | |
parent | 7f8f8d6cb7874369c36553cd8cc500de1b572b31 (diff) | |
download | rneovim-3f5c647de97a424d8a06e85b912ed46cc3ca8298.tar.gz rneovim-3f5c647de97a424d8a06e85b912ed46cc3ca8298.tar.bz2 rneovim-3f5c647de97a424d8a06e85b912ed46cc3ca8298.zip |
perf(memory): use an arena for RPC decoding
drawback: tracing memory errors with ASAN is less accurate for arena
allocated memory.
Therefore, to start with it is being used for Object types around
serialization/deserialization exclusively. This is going to have
a large impact especially when TUI is refactored as a co-prosess
as all UI events will be serialized and deserialized by nvim itself.
Diffstat (limited to 'src/nvim/memory.h')
-rw-r--r-- | src/nvim/memory.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/nvim/memory.h b/src/nvim/memory.h index a4be2643d8..0c048e1b5b 100644 --- a/src/nvim/memory.h +++ b/src/nvim/memory.h @@ -37,6 +37,20 @@ extern MemRealloc mem_realloc; extern bool entered_free_all_mem; #endif +typedef struct consumed_blk { + struct consumed_blk *prev; +} *ArenaMem; + +#define ARENA_ALIGN sizeof(void *) + +typedef struct { + char *cur_blk; + size_t pos, size; +} Arena; + +// inits an empty arena. use arena_start() to actually allocate space! +#define ARENA_EMPTY { .cur_blk = NULL, .pos = 0, .size = 0 } + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "memory.h.generated.h" #endif |