mono-jemalloc.h 992 B

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * \file
  3. *
  4. * Header for jemalloc registration code
  5. */
  6. #ifndef __MONO_JEMALLOC_H__
  7. #define __MONO_JEMALLOC_H__
  8. #if defined(MONO_JEMALLOC_ENABLED)
  9. #include <jemalloc/jemalloc.h>
  10. /* Jemalloc can be configured in three ways.
  11. * 1. You can use it with library loading hacks at run-time
  12. * 2. You can use it as a global malloc replacement
  13. * 3. You can use it with a prefix. If you use it with a prefix, you have to explicitly name the malloc function.
  14. *
  15. * In order to make this feature able to be toggled at run-time, I chose to use a prefix of mono_je.
  16. * This mapping is captured below in the header, in the spirit of "no magic constants".
  17. *
  18. * The place that configures jemalloc and sets this prefix is in the Makefile in
  19. * mono/jemalloc/Makefile.am
  20. *
  21. */
  22. #define MONO_JEMALLOC_MALLOC mono_jemalloc
  23. #define MONO_JEMALLOC_REALLOC mono_jerealloc
  24. #define MONO_JEMALLOC_FREE mono_jefree
  25. #define MONO_JEMALLOC_CALLOC mono_jecalloc
  26. void mono_init_jemalloc (void);
  27. #endif
  28. #endif