Skip to content

Conversation

@iProzd
Copy link
Collaborator

@iProzd iProzd commented Jan 6, 2026

Summary by CodeRabbit

  • Tests
    • Added periodic garbage collection during test teardown (runs once every 100 teardowns) to reduce accumulated memory.
    • Introduced a global counter to track cleanup invocations across test runs.
    • Improves test resource cleanup and visibility into cleanup frequency, with no changes to product-facing behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions github-actions bot added the Python label Jan 6, 2026
@iProzd iProzd requested a review from njzjz January 6, 2026 10:31
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 6, 2026

📝 Walkthrough

Walkthrough

Adds a module-level test counter and updates the test backend teardown to increment it, invoking garbage collection every 100th teardown.

Changes

Cohort / File(s) Summary
Test teardown update
source/tests/universal/pt/backend.py
Added import gc and import ...utils (relative); in tearDownClass increment utils.CPU_MEM_CLEAN_COUNT and call gc.collect() when the counter is a multiple of 100.
Test utils state
source/tests/utils.py
Added module-level variable CPU_MEM_CLEAN_COUNT = 0.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore(ut): release memory after ut' clearly and concisely describes the main change: adding garbage collection logic to release memory after unit tests complete.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 02980e5 and ce7a0bc.

📒 Files selected for processing (1)
  • source/tests/universal/pt/backend.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • source/tests/universal/pt/backend.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (28)
  • GitHub Check: Test Python (1, 3.10)
  • GitHub Check: Test Python (5, 3.10)
  • GitHub Check: Test Python (4, 3.13)
  • GitHub Check: Test Python (5, 3.13)
  • GitHub Check: Test Python (3, 3.10)
  • GitHub Check: Test Python (4, 3.10)
  • GitHub Check: Test Python (2, 3.13)
  • GitHub Check: Test Python (3, 3.13)
  • GitHub Check: Test Python (6, 3.10)
  • GitHub Check: Test Python (1, 3.13)
  • GitHub Check: Test Python (2, 3.10)
  • GitHub Check: Test Python (6, 3.13)
  • GitHub Check: Build C++ (clang, clang)
  • GitHub Check: Build C++ (cpu, cpu)
  • GitHub Check: Build C++ (rocm, rocm)
  • GitHub Check: Build C++ (cuda120, cuda)
  • GitHub Check: Build C library (2.18, libdeepmd_c.tar.gz)
  • GitHub Check: Build wheels for cp311-win_amd64
  • GitHub Check: Analyze (c-cpp)
  • GitHub Check: Analyze (python)
  • GitHub Check: Build wheels for cp311-macosx_arm64
  • GitHub Check: Build wheels for cp311-macosx_x86_64
  • GitHub Check: Build wheels for cp311-manylinux_x86_64
  • GitHub Check: Build wheels for cp310-manylinux_aarch64
  • GitHub Check: Test C++ (false, false, false, true)
  • GitHub Check: Test C++ (true, false, false, true)
  • GitHub Check: Test C++ (false, true, true, false)
  • GitHub Check: Test C++ (true, true, true, false)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@njzjz njzjz enabled auto-merge January 6, 2026 11:20
@njzjz njzjz disabled auto-merge January 6, 2026 12:23
Copy link
Member

@njzjz njzjz left a comment

Choose a reason for hiding this comment

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

It seems too slow..

@njzjz njzjz closed this Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants