Skip to content

Free SHM memory pages after pipeline teardown and Single Thread timer implementation - #613

Open
skywojciechowskim wants to merge 2 commits into
release/v0.22.4from
FreeShmPagesAndSingleTimer_86
Open

skywojciechowskim wants to merge 2 commits into
release/v0.22.4from
FreeShmPagesAndSingleTimer_86

Conversation

@skywojciechowskim

Copy link
Copy Markdown
Contributor

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

Copilot AI balanced review requested due to automatic review settings September 30, 2026 13:19
@github-actions

Copy link
Copy Markdown

Pull request must be merged with a description containing the required fields,

Summary:
Type: Feature/Fix/Cleanup
Test Plan:
Jira:

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 High severity · 2 Medium severity

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.

Comment thread common/source/Timer.cpp
Comment on lines +120 to +123
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();
Comment thread common/source/Timer.cpp
Comment on lines +132 to +136
m_timerId = g_timeout_add_once(
static_cast<guint>(timeout.count()),
[](gpointer data)
{
auto callback = CommonTimerLoop::instance().getTimerCallback(static_cast<Timer *>(data));
Comment thread common/CMakeLists.txt
Comment on lines +25 to +26
find_package( PkgConfig REQUIRED )
pkg_check_modules( GStreamerApp REQUIRED IMPORTED_TARGET gstreamer-app-1.0 gstreamer-pbutils-1.0 gstreamer-audio-1.0)
Comment on lines +232 to +234
const std::uint32_t kLength{partition->dataBufferVideoLen + partition->dataBufferAudioLen +
partition->dataBufferSubtitleLen};
madvise(partitionDataPtr, kLength, MADV_DONTNEED);
@github-actions

Copy link
Copy Markdown

Coverage statistics of your commit:
Congratulations, your commit improved lines coverage from: 0.0% to 84.3%
Congratulations, your commit improved functions coverage from: 0.0% to 92.7%

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants