diff --git a/projects/jemalloc.net/package.yml b/projects/jemalloc.net/package.yml new file mode 100644 index 00000000..f7eb2a8e --- /dev/null +++ b/projects/jemalloc.net/package.yml @@ -0,0 +1,29 @@ +distributable: + url: https://github.com/jemalloc/jemalloc/releases/download/{{version}}/jemalloc-{{version}}.tar.bz2 + strip-components: 1 + +versions: + github: jemalloc/jemalloc + +build: + dependencies: + tea.xyz/gx/cc: c99 + tea.xyz/gx/make: '*' + gnu.org/autoconf: '*' + docbook.org: '*' + script: | + ./configure $ARGS + make --jobs {{ hw.concurrency }} + make install + env: + ARGS: + - --prefix="{{prefix}}" + - --disable-debug + - --with-jemalloc-prefix= + +test: + dependencies: + tea.xyz/gx/cc: c99 + script: | + cc test.c -L {{prefix}}/lib -ljemalloc -o test + ./test diff --git a/projects/jemalloc.net/test.c b/projects/jemalloc.net/test.c new file mode 100644 index 00000000..b20e3f99 --- /dev/null +++ b/projects/jemalloc.net/test.c @@ -0,0 +1,13 @@ +#include +#include + + int main(void) { + + for (size_t i = 0; i < 1000; i++) { + // Leak some memory + malloc(i * 100); + } + + // Dump allocator statistics to stderr + malloc_stats_print(NULL, NULL, NULL); + }