Skip to content

🐛 clear chain after finalize#4027

Merged
dd-mergequeue[bot] merged 2 commits intomainfrom
adlrb/memory-leak
Dec 15, 2025
Merged

🐛 clear chain after finalize#4027
dd-mergequeue[bot] merged 2 commits intomainfrom
adlrb/memory-leak

Conversation

@mormubis
Copy link
Contributor

@mormubis mormubis commented Dec 11, 2025

Motivation

A memory leak occurs when the detached elements of a click chain are collected.

Changes

This PR frees the current click chain, releasing the memory related to the event targets clicked in the chain.

Test instructions

  • Go to https://app.datadoghq.com/rum/list
  • Open dev tools
  • Navigate to the Memory tab
  • Take a heap snapshot
  • Click on Set Up Manually
  • Click on React
  • Close the modal
  • Take another heap snapshot
  • Compare both snapshots
  • Check that there are several buttons (originally from the modal) that are retained in memory due to the click chain

Repeat the same steps with the SDK from this branch.

  • Check there are no buttons from the modal retained in memory

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.

@cit-pr-commenter
Copy link

cit-pr-commenter bot commented Dec 11, 2025

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 164.30 KiB 164.31 KiB +9 B +0.01%
Rum Profiler 5.21 KiB 5.21 KiB 0 B 0.00%
Rum Recorder 19.74 KiB 19.74 KiB 0 B 0.00%
Logs 56.14 KiB 56.14 KiB 0 B 0.00%
Flagging 944 B 944 B 0 B 0.00%
Rum Slim 121.57 KiB 121.58 KiB +9 B +0.01%
Worker 23.63 KiB 23.63 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base CPU Time (ms) Local CPU Time (ms) 𝚫%
RUM - add global context 0.005 0.0044 -12.00%
RUM - add action 0.0121 0.0151 +24.79%
RUM - add error 0.0167 0.0119 -28.74%
RUM - add timing 0.0034 0.0026 -23.53%
RUM - start view 0.0037 0.0036 -2.70%
RUM - start/stop session replay recording 0.0007 0.0008 +14.29%
Logs - log message 0.0161 0.0145 -9.94%
🧠 Memory Performance
Action Name Base Memory Consumption Local Memory Consumption 𝚫
RUM - add global context 25.96 KiB 25.45 KiB -520 B
RUM - add action 49.86 KiB 49.41 KiB -461 B
RUM - add timing 25.48 KiB 24.07 KiB -1.42 KiB
RUM - add error 52.24 KiB 54.16 KiB +1.91 KiB
RUM - start/stop session replay recording 23.53 KiB 23.55 KiB +21 B
RUM - start view 427.99 KiB 423.44 KiB -4.55 KiB
Logs - log message 43.83 KiB 43.82 KiB -13 B

🔗 RealWorld

@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Dec 11, 2025

⚠️ Tests

⚠️ Warnings

❄️ 1 New flaky test detected

scroll getScrollX/Y normalized scroll updates when scrolled from Chrome 139.0.0.0 (Android 10) (Datadog) (Fix with Cursor)
Error: Expected 100 to be 100.1307144165039.
    at <Jasmine>
    at UserContext.<anonymous> (webpack:///packages/rum-core/src/browser/scroll.spec.ts:46:28 <- /tmp/_karma_webpack_217992/commons.js:74493:75)
    at <Jasmine>

ℹ️ Info

🧪 All tests passed

🎯 Code Coverage
Patch Coverage: 100.00%
Overall Coverage: 92.63% (+0.00%)

View detailed report

This comment will be updated automatically if new data arrives.
* Fix with Cursor requires Datadog plugin ≥v2.17.0
🔗 Commit SHA: d7443a9 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@mormubis mormubis marked this pull request as ready for review December 12, 2025 14:03
@mormubis mormubis requested a review from a team as a code owner December 12, 2025 14:03
@mormubis
Copy link
Contributor Author

/merge

@dd-devflow-routing-codex
Copy link

dd-devflow-routing-codex bot commented Dec 15, 2025

View all feedbacks in Devflow UI.

2025-12-15 15:33:26 UTC ℹ️ Start processing command /merge


2025-12-15 15:33:33 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 52m (p90).


2025-12-15 15:59:25 UTC ℹ️ MergeQueue: This merge request was merged

@dd-mergequeue dd-mergequeue bot merged commit a55b1fb into main Dec 15, 2025
22 checks passed
@dd-mergequeue dd-mergequeue bot deleted the adlrb/memory-leak branch December 15, 2025 15:59
@github-actions github-actions bot locked and limited conversation to collaborators Dec 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants