-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
memory leak #137
Comments
refcount > 1 有其他 Mat 共享这个 data,所以不能 fastFree ... |
为什么判断是NCNN_XADD(refcount, -1) == 1,而不是NCNN_XADD(refcount, -1) == 0? 不是引用计数为0的时候释放内存么? |
NCNN_XADD 返回的是 XADD 之前的值 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
inline void Mat::release()
{
if (refcount && NCNN_XADD(refcount, -1) == 1)
fastFree(data);
}
假设Mat的refcount != 1,则不会执行fastFree,而此时data=0,则内存泄漏
The text was updated successfully, but these errors were encountered: