RenderHeads / UnityPlugin-AVProLiveCamera

AVPro Live Camera is a Unity plugin for webcams, TV cards and capture cards

Home Page:https://renderheads.com/products/avpro-live-camera/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Memory leak with _supportHotSwapping turned on

winson129 opened this issue · comments

If I have "support hot swapping" turned on, memory goes up by about 40/MBs a second. Looking into the code a bit, the offending line is AVProLiveCameraPlugin.UpdateDevicesConnected(); in the Update method. This is all fine if I don't turn on/off my webcam while it's running. But once the scene is running, turning on/off my webcam and calling this line will cause the memory usage to go up forever until the scene is stopped. It doesn't come back down either even after it's stopped until the Unity Editor is closed completely. My project requires the hot swapping feature as we needed to handle the case where a camera is plugged in after the scene is played, so any help on this would be much appreciated. Thank you very much in advance.

  • Unity version: 2018.3.12 and 2020.1.14 (tried on both versions)
  • AVPro Live Camera version: 2.9
  • Operating system version: Windows 10
  • Hardware/webcam model: I am using a MSI laptop and this is a built in webcam with the device name: "HD Webcam"
  • Video mode (resolution, frame-rate, etc): 1280x720, 10fps

Steps to reproduce the behavior:

  1. I had my built-in webcam turned off.
  2. Open one of the demo scenes from the asset store. I chose the "GUIDemo" scene.
  3. Select the LiveCameraManager gameobject and toggle on "support hot swapping" from the inspector.
  4. Play the scene in Unity editor.
  5. Press FN + F6 on my keyboard to turn on the built-in webcam to simulate plugging in a webcam.
  6. Now RAM usage goes up by about 40/MBs a second in the task manager until I stop the scene.

There are no error logs whatsoever. It doesn't log anything except "[AVProLiveCamera] version 2.9.0 initialised." in the console.