Skip to content
Snippets Groups Projects

add option to link sbin/kresd to jemalloc

Merged Vladimír Čunát requested to merge jemalloc into master
4 files
+ 48
0
Compare changes
  • Side-by-side
  • Inline
Files
4
  • And by default do so iff jemalloc is found.
    
    I chose the simplicity of adding the chosen allocator just
    in the single binary.  Other sbin/* don't matter really,
    and dynamic libs (e.g. modules) will just follow whoever loaded them.
+ 20
0
@@ -35,6 +35,26 @@
#endif
#include <libknot/error.h>
#if ENABLE_JEMALLOC
/* Make the jemalloc library needed.
*
* The problem is with --as-needed for linker which is added by default by meson.
* If we don't use any jemalloc-specific calls, linker will decide that
* it is not needed and won't link it. Making it needed seems better than
* trying to override the flag which might be useful in some other cases, etc.
*
* Exporting the function is a very easy way of ensuring that it's not optimized out.
*/
#include <jemalloc/jemalloc.h>
KR_EXPORT void kr_jemalloc_unused(void)
{
malloc_stats_print(NULL, NULL, NULL);
}
/* We don't use threads (or rarely in some parts), so multiple arenas don't make sense.
https://jemalloc.net/jemalloc.3.html
*/
KR_EXPORT const char *malloc_conf = "narenas:1";
#endif
struct args the_args_value; /** Static allocation for the_args singleton. */
Loading