diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2015-04-12 11:34:58 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2015-04-12 17:20:24 -0300 |
commit | ba10e311bddab18e38b1b706e232f804c2da9174 (patch) | |
tree | a4b66f731ff0c1a37a241b740a8e5465320d3a7a /src/nvim/msgpack_rpc | |
parent | 27b5ef3975e22c7d62e8dbe780dc75607e36eb43 (diff) | |
download | rneovim-ba10e311bddab18e38b1b706e232f804c2da9174.tar.gz rneovim-ba10e311bddab18e38b1b706e232f804c2da9174.tar.bz2 rneovim-ba10e311bddab18e38b1b706e232f804c2da9174.zip |
memory: Replace klib memory pools by malloc/free
Klib pools were used to improve allocation efficiency for some small objects,
but it is not a thread-safe approach. Thread safety in allocations will be
required for implementing #2371).
Diffstat (limited to 'src/nvim/msgpack_rpc')
-rw-r--r-- | src/nvim/msgpack_rpc/channel.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c index 35549ce042..34879e425e 100644 --- a/src/nvim/msgpack_rpc/channel.c +++ b/src/nvim/msgpack_rpc/channel.c @@ -5,8 +5,6 @@ #include <uv.h> #include <msgpack.h> -#include "nvim/lib/klist.h" - #include "nvim/api/private/helpers.h" #include "nvim/api/vim.h" #include "nvim/msgpack_rpc/channel.h" @@ -69,10 +67,6 @@ typedef struct { uint64_t request_id; } RequestEvent; -#define _noop(x) -KMEMPOOL_INIT(RequestEventPool, RequestEvent, _noop) -static kmempool_t(RequestEventPool) *request_event_pool = NULL; - static uint64_t next_id = 1; static PMap(uint64_t) *channels = NULL; static PMap(cstr_t) *event_strings = NULL; @@ -85,7 +79,6 @@ static msgpack_sbuffer out_buffer; /// Initializes the module void channel_init(void) { - request_event_pool = kmp_init(RequestEventPool); channels = pmap_new(uint64_t)(); event_strings = pmap_new(cstr_t)(); msgpack_sbuffer_init(&out_buffer); @@ -455,7 +448,7 @@ static void handle_request(Channel *channel, msgpack_object *request) Array args = ARRAY_DICT_INIT; msgpack_rpc_to_array(request->via.array.ptr + 3, &args); bool defer = (!kv_size(channel->call_stack) && handler.defer); - RequestEvent *event_data = kmp_alloc(RequestEventPool, request_event_pool); + RequestEvent *event_data = xmalloc(sizeof(RequestEvent)); event_data->channel = channel; event_data->handler = handler; event_data->args = args; @@ -487,7 +480,7 @@ static void on_request_event(Event event) // All arguments were freed already, but we still need to free the array free(args.items); decref(channel); - kmp_free(RequestEventPool, request_event_pool, e); + free(e); } static bool channel_write(Channel *channel, WBuffer *buffer) |