You forgot to free copied keys and values.
Also: Allocating every single value is slow. Instead allocate a single big memory pages and
allocate keys,values at the end of the used space.
If you manage the memory pages in a list then you should free every single page of this list in sparse_dict_free to prevent a memory leak.
Hint: If you develop on Linux with gcc you could use malloc_stats() to print the memory in use!
You forgot to free copied keys and values.
Also: Allocating every single value is slow. Instead allocate a single big memory pages and
allocate keys,values at the end of the used space.
If you manage the memory pages in a list then you should free every single page of this list in sparse_dict_free to prevent a memory leak.
Hint: If you develop on Linux with gcc you could use malloc_stats() to print the memory in use!