SWDEV-224639 - Device memory is still occupied

- Add cache free on OCL context destroy
- Remove std::mem_fun() usage, since it was removed in c++17

Change-Id: If6acd08f13a2298912ecd78fc025dcf0b32aee54
This commit is contained in:
German Andryeyev
2020-03-27 17:42:49 -04:00
bovenliggende 7ef8dfdfe7
commit 9f795d750d
4 gewijzigde bestanden met toevoegingen van 28 en 14 verwijderingen
+10 -8
Bestand weergeven
@@ -2187,7 +2187,7 @@ bool ResourceCache::free(size_t minCacheEntries) {
if (minCacheEntries < resCache_.size()) {
result = true;
// Clear the cache
while (static_cast<int>(cacheSize_) > 0) {
while (static_cast<int64_t>(cacheSize_) > 0) {
removeLast();
}
CondLog((cacheSize_ != 0), "Incorrect size for cache release!");
@@ -2201,14 +2201,16 @@ void ResourceCache::removeLast() {
{
// Protect access to the global data
amd::ScopedLock l(&lockCacheOps_);
entry = resCache_.back();
resCache_.pop_back();
cacheSize_ -= entry.second->iMem()->Desc().size;
if (entry.first->type_ == Resource::Local) {
lclCacheSize_ -= entry.second->iMem()->Desc().size;
if (resCache_.size() > 0) {
entry = resCache_.back();
resCache_.pop_back();
cacheSize_ -= entry.second->iMem()->Desc().size;
if (entry.first->type_ == Resource::Local) {
lclCacheSize_ -= entry.second->iMem()->Desc().size;
}
// Delete Descriptor
delete entry.first;
}
// Delete Descriptor
delete entry.first;
}
// Destroy PAL resource