RenderHeads / UnityPlugin-AVProMovieCapture

AVPro Movie Capture is a Unity Plugin for advanced video capture to AVI/MP4/MOV files
https://renderheads.com/products/avpro-movie-capture/
43 stars 8 forks source link

Big Memory Leak on Windows [Bug] #401

Open JavenRT opened 3 weeks ago

JavenRT commented 3 weeks ago

Unity Version

2023.1.20f1

AVPro Movie Capture Version

5.2.4

Which platform(s) are you using?

Windows

Which OS version(s) are you using?

Windows 11

Which rendering API(s) are you using?

Direct3D 12

Hardware

Processor: 13th Gen Intel(R) Core(TM) i9-13900HX 2.20 GHz Installed RAM: 32.0 GB (31.7 GB usable) System type: 64-bit operating system, x64-based processor

Which capture component are you using?

Capture From Texture

Capture mode

Realtime

Which output mode are you using?

Video file

Video codecs

H264

Audio source

Unity

Audio codecs

AAC

Any other component configuration

Frame Rate: 30 Source Texture: camera.targetTexture Camera Render Resolution: HD_1920x1080 Output Target: Video File

The issue

We use a video recorder script that creates videos using this package, the videos are tours of a room and an audio clip is played through unity over the top. This functions perfectly fine on our Mac platform. On Windows however, it only works well the first time, if a second video is recorded we incur a memory leak of a few hundred mb every second, until we reach max memory and the application crashes. This occurs in builds, but also in editor. On occasion the leak does stop however the accrued memory is not released at any point. Additionally we have had builds were this issue was not present. After memory profiling we can see the memory is classed as untracked memory, meaning it must not be managed by the Unity Memory Management API (attached). It appears in private and system heap. We initially used an older version of the package but after trying the newest one 5.2.4, the issue persisted.

Build 1 build 2

image

Log output

No response

JavenRT commented 3 weeks ago

I should mention, we destroy the CaptureFromTexture object between each recording. And add the component again when it is time to record another.