File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -248,6 +248,7 @@ class CV_EXPORTS Context
248
248
const Device& device (size_t idx) const ;
249
249
Program getProg (const ProgramSource& prog,
250
250
const String& buildopt, String& errmsg);
251
+ void unloadProg (Program& prog);
251
252
252
253
static Context& getDefault (bool initialize = true );
253
254
void * ptr () const ;
Original file line number Diff line number Diff line change @@ -1380,6 +1380,23 @@ struct Context::Impl
1380
1380
return prog;
1381
1381
}
1382
1382
1383
+ void unloadProg (Program& prog)
1384
+ {
1385
+ cv::AutoLock lock (program_cache_mutex);
1386
+ for (CacheList::iterator i = cacheList.begin (); i != cacheList.end (); ++i)
1387
+ {
1388
+ phash_t ::iterator it = phash.find (*i);
1389
+ if (it != phash.end ())
1390
+ {
1391
+ if (it->second .ptr () == prog.ptr ())
1392
+ {
1393
+ phash.erase (*i);
1394
+ cacheList.erase (i);
1395
+ return ;
1396
+ }
1397
+ }
1398
+ }
1399
+ }
1383
1400
1384
1401
IMPLEMENT_REFCOUNTABLE ();
1385
1402
@@ -1643,7 +1660,11 @@ Program Context::getProg(const ProgramSource& prog,
1643
1660
return p ? p->getProg (prog, buildopts, errmsg) : Program ();
1644
1661
}
1645
1662
1646
-
1663
+ void Context::unloadProg (Program& prog)
1664
+ {
1665
+ if (p)
1666
+ p->unloadProg (prog);
1667
+ }
1647
1668
1648
1669
#ifdef HAVE_OPENCL_SVM
1649
1670
bool Context::useSVM () const
You can’t perform that action at this time.
0 commit comments