Updated by Kirill Kornyakov about 12 years ago
Behaviour is changed since previous version.
Is it correct, that opencv could delete memory pointer, allocated somewhere outside the library?
I have noticed that when I i use this c-tor:
<pre>
cv::Mat(int
@cv::Mat(int ndims, const int* sizes, int type, void* data, const size_t* steps=0)
</pre> @
In in stock 2.4.3, where data is pointer to some memory allocated before.
Then, when @cv::Mat@ cv::Mat will be destroyed, data will be deallocated (in my case only try to deallocate)
<pre> @void Mat::deallocate()@
void Mat::deallocate() @{@
{
@ if( allocator )
)@
@ allocator->deallocate(refcount, datastart, data);
else
{
data);@
@ else@
@ {@
@ CV_DbgAssert(refcount != 0);
fastFree(datastart);
} 0);@
} @ fastFree(datastart);@
</pre> @ }@
@}@
I think in this case (allocator==0, OpenCV opencv does not own the memory) @fastFree@ call fastFree is incorrect.
Is it correct, that opencv could delete memory pointer, allocated somewhere outside the library?
I have noticed that when I i use this c-tor:
<pre>
cv::Mat(int
@cv::Mat(int ndims, const int* sizes, int type, void* data, const size_t* steps=0)
</pre> @
In in stock 2.4.3, where data is pointer to some memory allocated before.
Then, when @cv::Mat@ cv::Mat will be destroyed, data will be deallocated (in my case only try to deallocate)
<pre> @void Mat::deallocate()@
void Mat::deallocate() @{@
{
@ if( allocator )
)@
@ allocator->deallocate(refcount, datastart, data);
else
{
data);@
@ else@
@ {@
@ CV_DbgAssert(refcount != 0);
fastFree(datastart);
} 0);@
} @ fastFree(datastart);@
</pre> @ }@
@}@
I think in this case (allocator==0, OpenCV opencv does not own the memory) @fastFree@ call fastFree is incorrect.