Flow-IPC 3.0.0
Flow-IPC project: Full implementation reference.
Macros
jemalloc.hpp File Reference

Go to the source code of this file.

Macros

#define IPC_SHM_ARENA_LEND_JEMALLOC_API_PREFIX_CONCAT(ARG_1, ARG_2)    IPC_SHM_ARENA_LEND_JEMALLOC_API_PREFIX_CONCAT_IMPL(ARG_1, ARG_2)
 Helper macro to enable IPC_SHM_ARENA_LEND_JEMALLOC_API() impl to work. More...
 
#define IPC_SHM_ARENA_LEND_JEMALLOC_API_PREFIX_CONCAT_IMPL(ARG_1, ARG_2)    ARG_1 ## ARG_2
 Helper macro to enable IPC_SHM_ARENA_LEND_JEMALLOC_API() impl to work. More...
 
#define IPC_SHM_ARENA_LEND_JEMALLOC_API(ARG_api_name)    IPC_SHM_ARENA_LEND_JEMALLOC_API_PREFIX_CONCAT(IPC_SHM_ARENA_LEND_JEMALLOC_API_PREFIX, ARG_api_name)
 To be used when invoking jemalloc public API functions, this evaluates to the given argument (which shall be a function name) pre-pended with the value of macro IPC_SHM_ARENA_LEND_JEMALLOC_API_PREFIX. More...
 

Macro Definition Documentation

◆ IPC_SHM_ARENA_LEND_JEMALLOC_API

#define IPC_SHM_ARENA_LEND_JEMALLOC_API (   ARG_api_name)     IPC_SHM_ARENA_LEND_JEMALLOC_API_PREFIX_CONCAT(IPC_SHM_ARENA_LEND_JEMALLOC_API_PREFIX, ARG_api_name)

To be used when invoking jemalloc public API functions, this evaluates to the given argument (which shall be a function name) pre-pended with the value of macro IPC_SHM_ARENA_LEND_JEMALLOC_API_PREFIX.

For example IPC_SHM_ARENA_LEND_JEMALLOC_API(mallocx) might resolve to simply mallocx or je_mallocx depending on the value of IPC_SHM_ARENA_LEND_JEMALLOC_API_PREFIX.

Implementation notes

It can be head-breaking to understand why one needs those 2 levels of macros; in fact for me (ygoldfel) the comprehension arrives and leaves at will; but I assure you using only 1 intermediate macro that simply ##es the args together is not enough (let alone none).

Parameters
ARG_api_nameA jemalloc API sans prefix (e.g., malloc, mallocx).
Returns
It is replaced with the arg pre-pended by the prefix.
Note
As of this writing this is used only by .cpp files internal to Flow-IPC; and unit-test files near those; it is not used by headers. Therefore as of this writing it is sufficient to set IPC_SHM_ARENA_LEND_JEMALLOC_API_PREFIX value when building the library and unit tests – that is by Flow-IPC's internal build scripts – via compiler command-line macro-defines. If headers begin using jemalloc APIs – in templates, constexprs, and/or perhaps inlined functions – then we would need to dynamically generate and export a header containing IPC_SHM_ARENA_LEND_JEMALLOC_API_PREFIX definition (e.g., using a .hpp.in file turned into .hpp file by the build script). We would then #include that dynamically-generated header above this macro's definition in its containing header file (detail/jemalloc.hpp as of this writing).

Definition at line 87 of file jemalloc.hpp.

◆ IPC_SHM_ARENA_LEND_JEMALLOC_API_PREFIX_CONCAT

#define IPC_SHM_ARENA_LEND_JEMALLOC_API_PREFIX_CONCAT (   ARG_1,
  ARG_2 
)     IPC_SHM_ARENA_LEND_JEMALLOC_API_PREFIX_CONCAT_IMPL(ARG_1, ARG_2)

Helper macro to enable IPC_SHM_ARENA_LEND_JEMALLOC_API() impl to work.

Users of this header may ignore.

Parameters
ARG_1First thing.
ARG_2Second thing.
Returns
Replaced with the two concatenated.

Definition at line 48 of file jemalloc.hpp.

◆ IPC_SHM_ARENA_LEND_JEMALLOC_API_PREFIX_CONCAT_IMPL

#define IPC_SHM_ARENA_LEND_JEMALLOC_API_PREFIX_CONCAT_IMPL (   ARG_1,
  ARG_2 
)     ARG_1 ## ARG_2

Helper macro to enable IPC_SHM_ARENA_LEND_JEMALLOC_API() impl to work.

Users of this header may ignore.

Parameters
ARG_1First thing.
ARG_2Second thing.
Returns
Replaced with the two concatenated.

Definition at line 59 of file jemalloc.hpp.