fix MatAllocator creation/destruction issues

This commit is contained in:
Alexander Alekhin
2015-06-18 14:02:01 +03:00
parent b98a54fbe0
commit 032b6322fc
2 changed files with 13 additions and 4 deletions

View File

@@ -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 /////////////////////////////////////////////////