• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Jaded-Encoding-Thaumaturgy / vs-jetpack / 13621807102
66%

Build:
DEFAULT BRANCH: main
Ran 03 Mar 2025 01:59AM UTC
Jobs 2
Files 67
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

03 Mar 2025 01:56AM UTC coverage: 59.144% (+0.2%) from 58.978%
13621807102

push

github

web-flow
Use Vapoursynth's `register_on_destroy` to avoid caches leaking memory (#28)

I discovered there was a significant memory leak occurring, and traced
it back to the caches in `vs-tools`. The issue was that, because the
`Node`s stored in the caches keep references to the core, the
`finalize_core` hook meant to clear the caches was never being called,
because the caches themselves were keeping references to the core alive
and preventing `weakref.finalize` from running.

This change uses Vapoursynth's built-in `register_on_destroy` callback,
which hooks into the `Environment` instead of the `Core`, and causes the
destructors to run correctly and the caches to clear.

Minimal test script:
```python
import vapoursynth as vs
core = vs.core

import vstools
clip = core.bs.VideoSource(source="testfile.mkv")
matrix = vstools.Matrix.from_video(clip)
clip.set_output(0)
```

Valgrind Before (`vspipe -i test.vpy`):
```
==113446== LEAK SUMMARY:
==113446==    definitely lost: 0 bytes in 0 blocks
==113446==    indirectly lost: 0 bytes in 0 blocks
==113446==      possibly lost: 35,055,210 bytes in 349 blocks
==113446==    still reachable: 141,604,241 bytes in 10,666 blocks
==113446==         suppressed: 72 bytes in 3 blocks
```

Valgrind After:
```
==113200== LEAK SUMMARY:
==113200==    definitely lost: 73,192 bytes in 9 blocks
==113200==    indirectly lost: 0 bytes in 0 blocks
==113200==      possibly lost: 7,648 bytes in 7 blocks
==113200==    still reachable: 5,947,622 bytes in 5,489 blocks
==113200==         suppressed: 48 bytes in 1 blocks
```

1 of 2 new or added lines in 1 file covered. (50.0%)

3512 of 5938 relevant lines covered (59.14%)

1.18 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
48.37
1.62% vstools/utils/vs_proxy.py
Jobs
ID Job ID Ran Files Coverage
1 13621807102.1 03 Mar 2025 01:59AM UTC 67
59.14
GitHub Action Run
2 13621807102.2 03 Mar 2025 02:00AM UTC 67
59.14
GitHub Action Run
Source Files on build 13621807102
  • Tree
  • List 67
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #13621807102
  • de3c82d8 on github
  • Prev Build on main (#13621009127)
  • Next Build on main (#13634067420)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc