grafana / grafana/pyroscope-java
Sub-optimal memory leak capabilities with Pyroscope Java agent
- Vorherrschende Sprache
- Java
- Sterne
- 126
- Forks
- 48
- Ø Merge
- 4 T. 14 Std.
- Gemergte PRs (30 T.)
- 5
Beschreibung
Hi,
I’m trying to use Grafana Pyroscope to find a simulated memory leak in a small example program. I have two methods called leak() and noLeak() where the leak() method saves data to a Set every time it is called and noLeak() only allocates some memory that will be garbage collected. When I use Async Profiler (2.9) locally with the –live option I see that the leak() method is “leaking” memory. When I try to use the Pyroscope agent instead (io.pyroscope:agent:0.11.3) I don’t see it nearly as clearly.




I used the following configuration when setting up the Pyroscope Java agent:
```
Config config = new Config.Builder()
.setApplicationName("leaktest-1")
.setFormat(Format.JFR)
.setServerAddress("http://localhost:4040/")
.setUploadInterval(Duration.ofSeconds(10))
.setProfilingEvent(EventType.ALLOC)
.setAllocLive(true)
.build();
```
When I run the async profiler, locally, for 60s or more then I can easily see the memory leak. When I run the async profiler for 10s or less than I observe the same behavior as I see with Pyroscope.

I also tried to change the upload interval of the Pyroscope Java agent to 60s, but I am still not able to see the memory leak in a good way.
Slack thread: https://grafana.slack.com/archives/C049PLMV8TB/p1683294542388929
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginne mit der mitgelieferten leaktest-Konfiguration und vergleiche die ALLOC/allocLive-Ausgabe des Pyroscope Java agent mit den --live-Ergebnissen von Async Profiler über 10 und 60 Sekunden. Als erledigt gilt, den Grund zu ermitteln, warum das Leak weniger sichtbar ist, oder die Einschränkung zu dokumentieren und das relevante Agent-Verhalten zu identifizieren, das geändert werden muss; es werden keine Repository-Dateien oder Tests genannt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- observability
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 28/100