提交 032b6322 编写于 作者: A Alexander Alekhin

fix MatAllocator creation/destruction issues

上级 b98a54fb
......@@ -222,10 +222,14 @@ public:
}
};
static StdMatAllocator *mat_allocator = NULL;
MatAllocator* Mat::getStdAllocator()
{
static StdMatAllocator allocator;
return &allocator;
if (mat_allocator == NULL)
{
mat_allocator = new StdMatAllocator();
}
return mat_allocator;
}
void swap( Mat& a, Mat& b )
......
......@@ -5160,10 +5160,15 @@ public:
MatAllocator* matStdAllocator;
};
// This line should not force OpenCL runtime initialization! (don't put "new OpenCLAllocator()" here)
static MatAllocator *ocl_allocator = NULL;
MatAllocator* getOpenCLAllocator()
{
static MatAllocator * allocator = new OpenCLAllocator();
return allocator;
if (ocl_allocator == NULL)
{
ocl_allocator = new OpenCLAllocator();
}
return ocl_allocator;
}
///////////////////////////////////////////// Utility functions /////////////////////////////////////////////////
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册