Commit 694e8cf
authored
fix(ios): resolve critical memory leak in video recording (flutter-webrtc#1960)
Issue flutter-webrtc#1959
Fixed memory leaks in FlutterRTCMediaRecorder that caused dramatic
memory growth during video recording, leading to app crashes.
The renderFrame: method was creating Core Foundation objects
(CMVideoFormatDescriptionRef and CMSampleBufferRef) 30-60 times per
second without releasing them, causing memory to accumulate rapidly.
Changes:
- Added CFRelease() calls for formatDescription and outBuffer
- Added NULL initialization and error checking for Core Foundation
objects
- Ensured proper cleanup on error paths
- Removed platform-specific conditional for pixel buffer release
This prevents memory from growing unbounded during recording sessions.1 parent 149c238 commit 694e8cf
1 file changed
+24
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
115 | 123 | | |
116 | 124 | | |
117 | 125 | | |
| |||
123 | 131 | | |
124 | 132 | | |
125 | 133 | | |
126 | | - | |
| 134 | + | |
127 | 135 | | |
128 | 136 | | |
129 | 137 | | |
| |||
133 | 141 | | |
134 | 142 | | |
135 | 143 | | |
136 | | - | |
137 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
138 | 158 | | |
139 | | - | |
140 | 159 | | |
141 | 160 | | |
142 | 161 | | |
143 | | - | |
144 | 162 | | |
145 | 163 | | |
146 | 164 | | |
| |||
0 commit comments