Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wiki 'Getting Started' example should clarify define JEMALLOC_MANGLE needs to be set #2552

Open
4-rodrigo-salazar opened this issue Oct 5, 2023 · 0 comments

Comments

@4-rodrigo-salazar
Copy link

4-rodrigo-salazar commented Oct 5, 2023

The getting started wiki provides a nice example which assumes that mangling is enabled:

#include <stdlib.h>
#include <jemalloc/jemalloc.h>

void
do_something(size_t i) {
        // Leak some memory.
        malloc(i * 100);
}

int
main(int argc, char **argv) {
        for (size_t i = 0; i < 1000; i++) {
                do_something(i);
        }

        // Dump allocator statistics to stderr.
        malloc_stats_print(NULL, NULL, NULL);

        return 0;
}

It seems this would only compile successfully if JEMALLOC_MANGLE is set (malloc_stats_print by default is only available using the prefix je_malloc_stats_print).

It would be helpful to a note in the wiki regarding how to turn on mangling for your compilation (either by providing the -DJEMALLOC_MANGLE flag in the compilation command or setting the define in the configure step) :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@4-rodrigo-salazar and others