You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Memory leak in the fvp_playground sample on Flutter eLinux affecting BOTH hardware and software decoders. RSS grows continuously with each video load/dispose cycle (~8 MiB per cycle), eventually leading to system crash from memory exhaustion.
Test Setup:
We added a Memory Test tab to the official fvp_playground sample that repeatedly creates and disposes VideoPlayerController instances. The test loads a video file, plays it for 3 seconds, pauses, disposes the controller, then loads a different video and repeats. This mimics real-world scenarios where videos are loaded, played, and disposed (e.g., sequential video playback, playlist functionality).
Severity:
Impact: Sample app RSS climbs by ~160 MiB every 20 load/dispose cycles; prolonged operation exhausts the 2 GB device and triggers OOM killer
Platform: RK3566 ARM64 embedded device with 2 GB RAM
Test Scenario: 20 video load/dispose cycles (alternating between 2 different video files)
Workaround: None identified
Root Cause Assessment:
This indicates a core MDK memory management issue affecting multiple decoder backends, NOT hardware-specific interop problems. The leak appears related to VideoFrame pool/queue management during player disposal and recreation cycles.
Expected Behavior
Memory usage should remain stable during repeated video player create/dispose cycles. After disposing a VideoPlayerController and its associated MDK player instance, native memory should be freed. RSS should stabilize or fluctuate within a small range rather than continuously growing.
Environment
OS:
Embedded Linux based on Buildroot
Kernel: Linux 6.1.x
Display Server: Wayland 1.20 with Weston 10.0 compositor
MDK logs are captured through Flutter's debug print and written to /home/root/flux/logs/fvp_playground.log.
Key Log Patterns Observed:
Hardware decoder (RockChip MPP):
FINE: [mdk] DRM-EGL interop via dma buf composed layers import w/ modifiers as an external rgba texture, reuse EGLImage: 0
FINEST: [mdk] VideoFrame87577@0.200200 to be destroyed is not rendered by 0x557f38c4c0
FINEST: [mdk] VideoFrame87589@0.458788 to be destroyed is not rendered by 0x557f3ca8f0
Software decoder (FFmpeg):
FINE: [mdk] video decoders: "FFmpeg"
FINE: [mdk] AVCodec.Video[h264.Main] decoder: 5 Frame threads
FINEST: [mdk] VideoFrame1438@1.042700 to be destroyed is not rendered by 0x559f4d0730
FINEST: [mdk] VideoFrame1571@0.500500 to be destroyed is not rendered by 0x559f4d0730
Both show the same "VideoFrame...to be destroyed is not rendered" pattern, suggesting unreleased frame pool resources.
Full logs with increased verbosity available upon request.
Crash
No immediate crash occurs, but extended operation (30-50+ load/dispose cycles) leads to:
OOM killer activation
System becomes unresponsive
Process terminated by kernel
Example from dmesg during extended software decoder test:
Out of memory: Killed process <pid> (fvp_playground) total-vm:XXXXkB, anon-rss:XXXXkB, file-rss:XXXXkB
No crash stack trace available as the issue is memory exhaustion rather than segmentation fault. Memory profiling with Valgrind or AddressSanitizer would be helpful to identify exact allocation sites.
MDK Memory Leak Bug Report
Describe the Bug
Memory leak in the
fvp_playgroundsample on Flutter eLinux affecting BOTH hardware and software decoders. RSS grows continuously with each video load/dispose cycle (~8 MiB per cycle), eventually leading to system crash from memory exhaustion.Test Setup:
We added a Memory Test tab to the official
fvp_playgroundsample that repeatedly creates and disposes VideoPlayerController instances. The test loads a video file, plays it for 3 seconds, pauses, disposes the controller, then loads a different video and repeats. This mimics real-world scenarios where videos are loaded, played, and disposed (e.g., sequential video playback, playlist functionality).Severity:
Root Cause Assessment:
This indicates a core MDK memory management issue affecting multiple decoder backends, NOT hardware-specific interop problems. The leak appears related to VideoFrame pool/queue management during player disposal and recreation cycles.
Expected Behavior
Memory usage should remain stable during repeated video player create/dispose cycles. After disposing a VideoPlayerController and its associated MDK player instance, native memory should be freed. RSS should stabilize or fluctuate within a small range rather than continuously growing.
Environment
OS:
GPU:
Hardware:
Software:
Reproduction Steps
fvp_playgroundsample from the FVP repositorylib/main.dart(code provided below)scripts/package_for_device.sh --release(or your platform's build process)/usr/lib/fvp_playground/(or run on your platform)/proc/self/status(VmRSS, RssAnon, RssFile, VmData)Memory Test Tab Code:
The test creates a simple widget that repeatedly:
VideoPlayerController.networkUrl(Uri.file(...))See complete implementation in the test widget that reads memory from
/proc/self/statusand counts DMA-BUF file descriptors in/proc/self/fd.Test Configuration:
Test Results
Hardware Decoder Test (RockChip MPP + DRM-EGL)
Configuration:
Memory Growth (20 iterations, ~6 minutes):
Total Growth: +160.2 MiB RSS, +51 DMA-BUF FDs
Growth Rate: ~8.0 MiB per iteration
Log Evidence:
MDK Logs Show:
reuse EGLImage: 0consistently (EGLImages not being reused)VideoFrame...to be destroyed is not renderedmessages (frames disposed without rendering)Software Decoder Test (FFmpeg CPU-only)
Configuration:
Test Setup:
Memory Growth (20 iterations, ~6 minutes):
Total Growth: +158.2 MiB RSS, 0 DMA-BUF FDs (as expected)
Growth Rate: ~7.9 MiB per iteration
Log Evidence:
MDK Logs Show:
VideoFrame...to be destroyed is not renderedpatternKey Findings
1. Both Decoders Leak
2. No DMA-BUF Involvement in Software Path
3. Common VideoFrame Pattern
Both decoders show identical disposal patterns:
Suggests frame pool/queue management issue in MDK core.
4. Memory Growth is Native
5. Hardware-Specific Issues
Hardware decoder has additional symptoms:
reuse EGLImage: 0(never reuses EGLImages)Log
Log Configuration:
The FVP plugin enables MDK logging via:
MDK logs are captured through Flutter's debug print and written to
/home/root/flux/logs/fvp_playground.log.Key Log Patterns Observed:
Hardware decoder (RockChip MPP):
Software decoder (FFmpeg):
Both show the same "VideoFrame...to be destroyed is not rendered" pattern, suggesting unreleased frame pool resources.
Full logs with increased verbosity available upon request.
Crash
No immediate crash occurs, but extended operation (30-50+ load/dispose cycles) leads to:
Example from
dmesgduring extended software decoder test:No crash stack trace available as the issue is memory exhaustion rather than segmentation fault. Memory profiling with Valgrind or AddressSanitizer would be helpful to identify exact allocation sites.
Comparison with Issue #304
Issue #304 (VAAPI + i915 memory leak, June 2025) reported:
Our case is more severe:
Root Cause Hypothesis
Primary: VideoFrame Pool Management
Secondary: Hardware EGLImage Reuse
For hardware decoder only:
reuse EGLImage: 0indicates no reuse between playersQuestions for MDK Maintainer
Why does FFmpeg software decoder leak when Issue Possible memory leak with VAAPI + i915 #304 reported no leak?
Are VideoFrames being properly freed during player disposal?
Is EGLImage reuse working correctly for RockChip MPP?
reuse EGLImage: 0always (never1)?Does MDK 0.35.0 include the Issue Possible memory leak with VAAPI + i915 #304 fix?
Is this specific to Flutter/eLinux usage pattern?
Additional Diagnostics Available
If needed, we can provide:
/proc/PID/smapsmemory maps during leak progressiondmesgReferences
Date: October 20, 2025
MDK Version: 0.35.0 (via FVP 0.35.0)
Platform: RK3566 ARM64, Mali-G52, Buildroot Linux, Wayland/Weston
Status: CRITICAL - Unresolved