First of all the purpose of the jemalloc (within my usecase) is to trace native memory allocations caused by things like JNI invocations, so let's begin:
Hello guys I have some serious issue here. We happen to have a memory leak in one of our applications. It is located in the JNI library in particular for those of you who know it - cplex. I already know that but since our manager asked me to get a proof now I am spending horrendously loads of time trying to get one. I have come across a monster tool (yes I know it is not just a tool) called jemalloc that supposed to create ".heap" files and that is great, I managed although I cannot see any way to actually read anything sensible from that file, here is the example:PNG image of the generated ".heap" file - first few lines only but it all looks pretty much like that
Than I have found out that there is that other monster called "jeprof" that apparently can convert that ".heap" file to the nice ".gif" - all you have to do is to run command like this: jeprof --show_bytes --gif /path/to/jvm/bin/java jeprof*.heap > /tmp/app-profiling.gif
and it should have resulted in something like example (and description) here: https://gdstechnology.blog.gov.uk/2015/12/11/using-jemalloc-to-get-to-the-bottom-of-a-memory-leak/
(you need to scroll the page down to the section "JEMALLOC to the rescue" to see the example of the gif I am talking about).
Unfortunately there is exactly 0 information on how to actually use it, aside of blogs like the one I have included. Every time I try to generate that gif using the exact command as: jeprof --show_bytes --gif java jeprof.out.14441.5.i5.heap > ../../../sheetchallenger/temp/app-profiling_14_10.gif
- I get the following answer and an empty gif being created having 0 bytes in size:
Use of uninitialized value $line in substitution (s///) at /usr/local/bin/jeprof line 3256.
http://jeprof.out.14441.5.i5.heap/pprof/symbol doesn't exist
Here is the "jeprof" file it seems to be talking about (I mean the section around the line 3256):
sub CheckSymbolPage {
my $url = SymbolPageURL();
my $command = ShellEscape(@URL_FETCHER, $url);
open(SYMBOL, "$command |") or error($command);
my $line = <SYMBOL>;
$line =~ s/\r//g; # Line:3256: turn windows-looking lines into unix-looking lines
close(SYMBOL);
unless (defined($line)) {
error("$url doesn't exist\n");
}
if ($line =~ /^num_symbols:\s+(\d+)$/) {
if ($1 == 0) {
error("Stripped binary. No symbols available.\n");
}
} else {
error("Failed to get the number of symbols from $url\n");
}
}
Literally no idea what is this trying to tell me, why does it use http? What for? I get that there is no profile created of some sort, or so it seems to be saying but what profile, where, how?
Perhaps it will be of help to mention that the first time I ran this "jeprof heap file to gif converting command" I have received the following response:
[root@mnd-dev-kfk01 sheetchallenger]# jeprof --show_bytes --gif java jeprof.out.12077.129.i129.heap > temp/app-profiling_11_24.gif
Using local file jeprof.out.12077.129.i129.heap.
The first profile should be a remote form to use /pprof/symbol
What on earth does that mean and why should I care - is this important, what remote form, form of what, for what?
So basically the question is: since I can already generate those unfortunate "*.heap" files (please somebody correct me if these files don't seem to be correct) how on earth can I convert them to something useful preferably using jeprof or anything else?
Can I convert them to that gif as shown on this site I have linked above (https://gdstechnology.blog.gov.uk/2015/12/11/using-jemalloc-to-get-to-the-bottom-of-a-memory-leak/) or can I do anything else with them?
Kind Regards to all of you and hopefully somebody can help me figure this thing out.