webrtc 的 rtc::scoped_refptr 踩坑

原创
2022/02/22 17:52
阅读数 197

多次将scoped_refptr赋值给另一个scoped_refptr对象造成了内存泄漏, 使用std::scoped_ptr包装一次后恢复正常,原因不明。

void main() {
	rtc::scoped_refptr<XXX> a = XXX::Create();
	rtc::scoped_refptr<XXX> b = a;
	b = a; 
}

class A {
	rtc::scoped_refptr<XXX> c; 
	void aaa() {
		rtc::scoped_refptr<XXX> a = XXX::Create();
		c = a;
		rtc::scoped_refptr<XXX> b = XXX::Create();
		c = b; 
	}
}
展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
0 评论
0 收藏
0
分享
返回顶部
顶部