多次将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;
}
}