From 3f5c647de97a424d8a06e85b912ed46cc3ca8298 Mon Sep 17 00:00:00 2001 From: bfredl Date: Thu, 2 Jun 2022 09:18:13 +0200 Subject: 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. --- src/nvim/tui/input.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/nvim/tui') diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c index c8083cddb1..3e24e892b8 100644 --- a/src/nvim/tui/input.c +++ b/src/nvim/tui/input.c @@ -144,8 +144,10 @@ static void tinput_wait_enqueue(void **argv) Error err = ERROR_INIT; ADD(args, STRING_OBJ(copy_string(keys))); // TODO(bfredl): could be non-blocking now with paste? - Object result = rpc_send_call(ui_client_channel_id, "nvim_input", args, &err); + ArenaMem res_mem = NULL; + Object result = rpc_send_call(ui_client_channel_id, "nvim_input", args, &res_mem, &err); consumed = result.type == kObjectTypeInteger ? (size_t)result.data.integer : 0; + arena_mem_free(res_mem, NULL); } else { consumed = input_enqueue(keys); } -- cgit