|
1 | | -# Essential Maven Goals: |
| 1 | +# Spring Boot Memory Leak Demo |
| 2 | + |
| 3 | +## Controller Configuration |
| 4 | + |
| 5 | +This demo includes two controllers that can be conditionally enabled based on the `coco` property: |
| 6 | + |
| 7 | +- **CocoController**: Contains intentional memory leaks for demonstration purposes |
| 8 | +- **WithoutCocoController**: Proper implementation with resource management |
| 9 | + |
| 10 | +### Configuration Options |
| 11 | + |
| 12 | +Set the `coco` property in your application properties: |
| 13 | + |
| 14 | +```properties |
| 15 | +# Enable CocoController (with memory leaks for demo purposes) |
| 16 | +coco=true |
| 17 | + |
| 18 | +# Enable WithoutCocoController (proper resource management) |
| 19 | +coco=false |
| 20 | +``` |
| 21 | + |
| 22 | +### Profile-Specific Configuration |
| 23 | + |
| 24 | +- **Default profile** (`application.properties`): `coco=true` (enables CocoController) |
| 25 | +- **Virtual Threads profile** (`application-vt.properties`): `coco=false` (enables WithoutCocoController) |
| 26 | + |
| 27 | +### Usage Examples |
| 28 | + |
| 29 | +```bash |
| 30 | +# Run with CocoController (memory leaks) |
| 31 | +./mvnw spring-boot:run |
| 32 | + |
| 33 | +# Run with WithoutCocoController (proper resource management) |
| 34 | +./mvnw spring-boot:run -Dspring.profiles.active=vt |
| 35 | + |
| 36 | +# Override property at runtime |
| 37 | +./mvnw spring-boot:run -Dcoco=false |
| 38 | +``` |
| 39 | + |
| 40 | +## Essential Maven Goals: |
2 | 41 |
|
3 | 42 | ```bash |
4 | 43 | # Analyze dependencies |
@@ -41,6 +80,29 @@ http://localhost:8080/swagger-ui/index.html |
41 | 80 |
|
42 | 81 | jwebserver -p 8005 -d "$(pwd)/examples/spring-boot-memory-leak-demo/profiler/results" |
43 | 82 |
|
| 83 | +## Enhanced Profiling with Java 25 JFR Support |
| 84 | + |
| 85 | +The profiler script has been enhanced with comprehensive Java 25 JFR support. See `profiler/JAVA25-JFR-FEATURES.md` for details. |
| 86 | + |
| 87 | +### New Profiling Options (v4.2): |
| 88 | +- **Option 17**: Enhanced JFR Memory Profiling (Java 21+) |
| 89 | +- **Option 18**: Java 25 CPU-Time Profiling (Linux only) |
| 90 | +- **Option 19**: Java 25 Method Tracing |
| 91 | +- **Option 20**: Advanced JFR with Custom Events |
| 92 | +- **Option 21**: JFR Memory Leak Analysis with TLAB tracking |
| 93 | + |
| 94 | +### Usage: |
| 95 | +```bash |
| 96 | +# Run the enhanced profiler |
| 97 | +./profiler/scripts/profile-java-process.sh |
| 98 | +
|
| 99 | +# Start the application first |
| 100 | +./mvnw spring-boot:run |
| 101 | +
|
| 102 | +# Then in another terminal, run the profiler and select from 21 options |
| 103 | +``` |
| 104 | + |
| 105 | +### Cursor Rules Integration: |
44 | 106 | My Java application has performance issues - help me set up comprehensive profiling process using @151-java-profiling-detect.md and use the location examples/spring-boot-memory-leak-demo/profiler |
45 | 107 |
|
46 | 108 | Analyze the results located in examples/spring-boot-memory-leak-demo/profiler and use the cursor rule @152-java-profiling-analyze |
|
0 commit comments