Last active
February 19, 2019 07:22
-
-
Save siddontang/7f5d85497b5f7493dcbf2898667db9ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
probe begin { | |
warn("Begin to trace jemalloc.\n") | |
} | |
probe process.function("malloc").return, | |
process.function("mallocx").return{ | |
if (pid() != target()) next | |
printf("malloc: %p, bytes: %d\n", $return, @entry($size)) | |
print_ubacktrace() | |
} | |
probe process.function("calloc").return { | |
if (pid() != target()) next | |
printf("malloc: %p, bytes: %d\n", $return, @entry($size) * @entry($num)) | |
print_ubacktrace() | |
} | |
probe process.function("realloc").return, | |
process.function("rallocx").return { | |
if (pid() != target()) next | |
printf("free: %p\n", @entry($ptr)) | |
printf("malloc: %p, bytes: %d\n", $return, @entry($size)) | |
print_ubacktrace() | |
} | |
probe process.function("free"), | |
process.function("sdallocx") { | |
if (pid() != target()) next | |
if ($ptr == 0) next | |
printf("free: %p\n", $ptr) | |
} | |
probe timer.s(10) { | |
exit() | |
} | |
/* | |
probe process.function("xallocx").return{ | |
if (pid() != target()) next | |
// TODO: do we need to print free $ptr here? | |
printf("malloc: %p, bytes: %d\n", $return, @entry($size) + @entry($extra)) | |
print_ubacktrace() | |
} | |
probe process.function("dallocx") { | |
if (pid() != target()) next | |
if ($ptr == 0) next | |
printf("free: %p\n", $ptr) | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/siddontang/8d5e4c8029e5b1df481546063842be91