Skip to content

Commit 5c30cf5

Browse files
committed
apparently we don't want to leak memory. Wish people would make up their mind.
Signed-off-by: Chris Perkins <[email protected]>
1 parent e2458f3 commit 5c30cf5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sycl/source/detail/device_global_map.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ class DeviceGlobalMap {
8888
if (findDevGlobalByValue != MPtr2DeviceGlobal.end())
8989
MPtr2DeviceGlobal.erase(findDevGlobalByValue);
9090

91-
MDeviceGlobals.erase(DevGlobalIt);
91+
// Must properly free the memory, will do in
92+
// removeAssociatedResources(). Now we blank the key so it isn't used.
93+
auto h = MDeviceGlobals.extract(DevGlobalIt);
94+
h.key() = "";
95+
MDeviceGlobals.insert(std::move(h));
9296
}
9397
}
9498
}

0 commit comments

Comments
 (0)