mirror of
https://github.com/neovim/neovim.git
synced 2025-10-04 17:06:30 +00:00
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.
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user