Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory leak when run with --v4l2_sink= #2279

Closed
2 tasks done
cadadr opened this issue Apr 26, 2021 · 2 comments
Closed
2 tasks done

memory leak when run with --v4l2_sink= #2279

cadadr opened this issue Apr 26, 2021 · 2 comments
Labels

Comments

@cadadr
Copy link

cadadr commented Apr 26, 2021

  • I have read the FAQ.
  • I have searched in existing issues.

Environment

  • OS: Debian Buster
  • scrcpy version: dev branch, commit 41a0383
  • installation method: manual build
  • device model: HTC Desire 728G Dual Sim
  • Android version: 5.1

Describe the bug

I built and ran scrcpy as such:

ADB=/home/g/Android/Sdk/platform-tools/adb ./run x --v4l2_sink=/dev/video0

It worked as expected but the memory usage began to increase rapidly, consuming all of 16GB of available memory eventually.

It increases way faster when a camera app is open on the phone (tried both stock app and OpenCamera, the same).

When I do the same without v4l2-loopback integration,

 ADB=/home/g/Android/Sdk/platform-tools/adb ./run x

the memory increase does not happen, scrcpy consumes suprisingly low memory actually.

@rom1v rom1v added the bug label Apr 26, 2021
rom1v added a commit that referenced this issue Apr 26, 2021
Unref frame immediately once encoded.

Fixes #2279 <#2279>
@rom1v
Copy link
Collaborator

rom1v commented Apr 26, 2021

This is the kind of bug report which is very useful to detect problems introduced on the dev branch, thank you very much! 👍

The memory leak is fixed by 1cde68a.
An additional (small) memory leak on error is fixed by 84f17fd.

--v4l2_sink

Oops, it seems I failed something in my rebase. Renamed to --v4l2-sink by 45e7280.

@rom1v rom1v closed this as completed Apr 26, 2021
@cadadr
Copy link
Author

cadadr commented Apr 26, 2021

You're very welcome and thank you sooo much!! I had a zoom meeting for tomorrow, this is literally godsend 😸

Tested standalone and with an OBS v4l2 connection and both memory usage and CPU usage are stable (maybe somewhat noticably higher than without v4l2 tho, at 18.8% CPU [went down to ~5% in a space of 5-10min] at 3.6/9GHz and 7.2%mem w/ 16GB mem, I can test and report back on Thursday if that's unexpected).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants