You could have the buffer be of 64k and alloc_cb just give out elices of 4096. If all slices are used you return no buffer and wat. This (using fixed size slices) would also allow you to remove the `memmove`.