Free SHM memory pages after pipeline teardown and Single Thread timer implementation - #613
skywojciechowskim wants to merge 2 commits into
Conversation
|
Pull request must be merged with a description containing the required fields, Summary: If there is no jira releated to this change, please put 'Jira: NO-JIRA'. Description can be changed by editing the top comment on your pull request and making a new commit. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Shared-memory reclamation is ineffective for some partitions, and timer lifecycle changes introduce compatibility and concurrency defects.
Review effort: Balanced
Findings: 2
Open (4)
What changed in this PR
Updates shared-memory teardown and consolidates timers onto a shared GLib event loop.
Changes:
- Attempts to reclaim shared-memory partition pages during teardown.
- Replaces per-timer threads with a shared timer loop.
- Adds timer-related GLib/GStreamer build dependencies.
| File | Description |
|---|---|
media/server/main/source/SharedMemoryBuffer.cpp |
Releases partition memory during unmapping. |
common/source/Timer.cpp |
Implements shared-loop timer scheduling and cancellation. |
common/include/Timer.h |
Replaces per-timer synchronization state with a GLib source ID. |
common/CMakeLists.txt |
Adds dependencies required by the timer implementation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| auto callback = CommonTimerLoop::instance().getTimerCallback(static_cast<Timer *>(data)); | ||
| if (callback) | ||
| { | ||
| std::unique_lock<std::mutex> lock{m_mutex}; | ||
| if (!m_cv.wait_for(lock, m_timeout, [this]() { return !m_active; })) | ||
| { | ||
| if (m_active && m_callback) | ||
| { | ||
| shouldExecuteCallback = true; | ||
| } | ||
| } | ||
| callback(); |
| m_timerId = g_timeout_add_once( | ||
| static_cast<guint>(timeout.count()), | ||
| [](gpointer data) | ||
| { | ||
| auto callback = CommonTimerLoop::instance().getTimerCallback(static_cast<Timer *>(data)); |
| find_package( PkgConfig REQUIRED ) | ||
| pkg_check_modules( GStreamerApp REQUIRED IMPORTED_TARGET gstreamer-app-1.0 gstreamer-pbutils-1.0 gstreamer-audio-1.0) |
| const std::uint32_t kLength{partition->dataBufferVideoLen + partition->dataBufferAudioLen + | ||
| partition->dataBufferSubtitleLen}; | ||
| madvise(partitionDataPtr, kLength, MADV_DONTNEED); |
|
Coverage statistics of your commit: |


Summary: Free SHM memory pages after pipeline teardown and Single Thread timer implementation
Type: Fix
Test Plan: UT/CT, Fullstack
Jira: RDKEMW-25420 RDKEMW-24084