Bug 498536 - Memory leak in PipeWireSourceStream when recording the screen
Summary: Memory leak in PipeWireSourceStream when recording the screen
Status: CONFIRMED
Alias: None
Product: KPipeWire
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-11 17:58 UTC by Женя Бородин
Modified: 2025-01-17 19:40 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Video showing the memory leak issue. (1.65 MB, video/x-matroska)
2025-01-11 17:58 UTC, Женя Бородин
Details
The attached file is the Heaptrack report containing information about memory allocations and leaks. (2.83 MB, application/zstd)
2025-01-11 18:49 UTC, Женя Бородин
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Женя Бородин 2025-01-11 17:58:04 UTC
Created attachment 177289 [details]
Video showing the memory leak issue.

SUMMARY
Memory leak in Spectacle when recording the screen on KDE Neon Unstable Edition.

STEPS TO REPRODUCE
1. Open Spectacle.
2. Start screen recording.
3. Wait for the memory usage to increase over time.

OBSERVED RESULT
Memory usage increases significantly, leading to high memory consumption and potential crashes over time.

EXPECTED RESULT
Screen recording should not cause memory leaks, and memory usage should remain stable throughout the process.

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 6.3.80
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.1
Kernel Version: 6.8.0-51-generic (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Xeon® CPU E3-1220 V2 @ 3.10GHz
Memory: 15.6 ГиБ of RAM
Graphics Processor: AMD Radeon RX 570 Series

ADDITIONAL INFORMATION
Screenshot authorization issue:
- When launching via Valgrind, the error `The process is not authorized to take a screenshot` occurs.
- Unable to perform memory leak analysis due to the inability to take a screenshot.

Original error message:
Ошибка запроса создания снимка экрана KWin: The process is not authorized to take a screenshot Сведения, которые, возможно, будут полезны:

Method: CaptureScreen
Method-specific arguments: "DVI-D-1"
Comment 1 Женя Бородин 2025-01-11 18:32:52 UTC
I was able to analyze a memory leak in the Spectacle application using Heaptrack. The tool revealed a significant number of memory leaks and identified problematic areas in memory usage.
heaptrack stats:
        allocations:            977621
        leaked allocations:     164050
        temporary allocations:  243418
Comment 2 Женя Бородин 2025-01-11 18:49:51 UTC
Created attachment 177290 [details]
The attached file is the Heaptrack report containing information about memory allocations and leaks.
Comment 3 Noah Davis 2025-01-12 05:04:55 UTC
According to the reporter's attached heaptrack report, the problem seems to come from KPipeWire's PipeWireSourceStream class.
Comment 4 John Kizer 2025-01-17 19:40:17 UTC
I can reproduce on Fedora KDE 41 - differently, based on what exactly is being recorded, and whether the mouse pointer is included:

Screen recording: Memory leaks regardless of mouse pointer setting
Window recording with mouse pointer: Memory leaks when the mouse cursor moves
Window recording with no mouse pointer: No major leak
Rectangular region: No major leak regardless of mouse pointer setting