Skip to content

Commit

Permalink
Merge pull request #304 from graalvm/ni-demos-refactoring-3
Browse files Browse the repository at this point in the history
[GR-60094] Refactor the demo for Create a Heap Dump from a Native Executable guide.
  • Loading branch information
olyagpl authored Dec 16, 2024
2 parents 2d4b840 + da607c2 commit bcf2be7
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 183 deletions.
43 changes: 0 additions & 43 deletions .github/workflows/native-heapdump-examples.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/native-image-create-heap-dumps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: native-image/create-heap-dumps
on:
push:
paths:
- 'native-image/create-heap-dumps/**'
- '.github/workflows/native-image-create-heap-dumps.yml'
pull_request:
paths:
- 'native-image/create-heap-dumps/**'
- '.github/workflows/native-image-create-heap-dumps.yml'
schedule:
- cron: "0 0 1 * *" # run every month
workflow_dispatch:
permissions:
contents: read
jobs:
run:
name: Run 'native-image/create-heap-dumps'
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
java-version: ['21', '24-ea']
steps:
- uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1
with:
java-version: ${{ matrix.java-version }}
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
- name: Run 'native-image/create-heap-dumps'
run: |
cd native-image/create-heap-dumps
./run.sh
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ cd graalvm-demos
<td align="left" width="70%">Demonstrates how to build a fully static and a mostly-static native executable.<br><strong>Technologies: </strong> Native Image <br><strong>Reference: </strong><a href="https://www.graalvm.org/latest/reference-manual/native-image/guides/build-static-executables/">Build a Statically Linked or Mostly-Statically Linked Native Executable</a></td>
</tr>
<tr>
<td align="left" width="30%"><a href="/native-heapdump-examples/">native-heapdump-examples</a><br><a href="https://github.com/graalvm/graalvm-demos/actions/workflows/native-heapdump-examples.yml"><img alt="native-heapdump-examples" src="https://github.com/graalvm/graalvm-demos/actions/workflows/native-heapdump-examples.yml/badge.svg"/></a></td>
<td align="left" width="30%"><a href="/native-image/create-heap-dumps/">native-image/create-heap-dumps</a><br><a href="https://github.com/graalvm/graalvm-demos/actions/workflows/native-image-create-heap-dumps.yml"><img alt="native-image/create-heap-dumps" src="https://github.com/graalvm/graalvm-demos/actions/workflows/native-image-create-heap-dumps.yml/badge.svg"/></a></td>
<td align="left" width="70%">Demonstrates different ways to generate a heap dump from a running native executable.<br><strong>Technologies: </strong> Native Image, VisualVM <br><strong>Reference: </strong><a href="https://www.graalvm.org/latest/reference-manual/native-image/guides/create-heap-dump/">Create a Heap Dump from a Native Executable</a></td>
</tr>
<tr>
Expand Down
139 changes: 0 additions & 139 deletions native-heapdump-examples/README.md

This file was deleted.

Binary file removed native-heapdump-examples/img/heap-dump-api.png
Binary file not shown.
Binary file removed native-heapdump-examples/img/heap-dump.png
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.class
*.txt
helloworld
svmheapdump
*.hprof
svmheapdumpapi
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions native-image/create-heap-dumps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Create a Heap Dump from a Native Executable

You can find the steps to run this demo on [the website](https://www.graalvm.org/latest/reference-manual/native-image/guides/create-heap-dump/).
File renamed without changes.
17 changes: 17 additions & 0 deletions native-image/create-heap-dumps/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -ex

# Dump the Initial Heap of a Native Executable
javac HelloWorld.java
native-image -Ob HelloWorld --enable-monitoring=heapdump
./helloworld -XX:+DumpHeapAndExit

# Create a Heap Dump with SIGUSR1 (Linux/macOS only)
javac SVMHeapDump.java
native-image -Ob SVMHeapDump --enable-monitoring=heapdump
./svmheapdump

# Create a Heap Dump from within a Native Executable
javac SVMHeapDumpAPI.java
native-image -Ob SVMHeapDumpAPI
./svmheapdumpapi --heapdump

0 comments on commit bcf2be7

Please sign in to comment.