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

Heap profiling for MacOS not working #2617

Open
airas-careem opened this issue Mar 11, 2024 · 2 comments
Open

Heap profiling for MacOS not working #2617

airas-careem opened this issue Mar 11, 2024 · 2 comments

Comments

@airas-careem
Copy link

airas-careem commented Mar 11, 2024

I have tried to experiment with heap profiling using jemalloc. I have cloned the repo, and built the library with the following steps


./autogen.sh
./configure --enable-prof
make
sudo make install

It did build the library and I confirmed with visiting /usr/local/lib for libjemalloc.dylib & /usr/local/bin for jeprof.

Now the issue is If I run my jar using

LD_PRELOAD=/usr/local/lib/libjemalloc.dylib \ MALLOC_CONF=prof:true,lg_prof_interval:1,lg_prof_sample:1,prof_prefix:/Users/airas/jeprof \ java -Dserver.port=8081 -XX:NativeMemoryTracking=summary -XX:+UnlockDiagnosticVMOptions -XX:+PrintNMTStatistics -XX:+CrashOnOutOfMemoryError -XX:CompressedClassSpaceSize=128m -XX:MinRAMPercentage=15.0 -XX:MaxRAMPercentage=15.0 -XX:InitialRAMPercentage=15.0 -XX:+UseG1GC -Dfile.encoding=UTF8 -Dserver.undertow.worker-threads=32 -Dserver.undertow.io-threads=4 -jar ./services/sender/target/sender-fat-exec.jar

I still do not see any heap dump file. I verified the permissions too, user is the same for the java process & directory where the heap file should be created.

@guangli-dai
Copy link
Contributor

This PR should solve the problem. It hasn't merged yet but should be soon.

@airas-careem
Copy link
Author

Thanks @guangli-dai. I will use the PR branch for later. I have now run my service in a container to generate heap files.

Also, I got two questions,

Q1: Can we manually create a heap file at any instance without service generating too many/few heap files? I would like to have a command that just generates a heap at that instance.

Q2: Currently I am generating a graph with the below command, is there a way I can just get a text report like we get in jcmd NMT report?

jeprof --show_bytes --gif /usr/local/openjdk-11/bin/java jeprof.8.3.i3.heap > output.gif

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

3 participants
@guangli-dai @airas-careem and others