Skip to content

Commit

Permalink
[SYCL][USM tests][E2E] Memory leak in math.cpp (intel#12353)
Browse files Browse the repository at this point in the history
This change fixes the zeMemAllocDevice memory leak in math.cpp

Signed-off-by: Zhang, Winston <[email protected]>
  • Loading branch information
winstonzhang-intel authored Jan 23, 2024
1 parent 1fccf00 commit e6d6a47
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sycl/test-e2e/USM/math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ int main() {
{
float *Buf = (float *)s::malloc_shared(
sizeof(float) * 2, myQueue.get_device(), myQueue.get_context());
s::malloc_shared(100, myQueue.get_device(), myQueue.get_context());
void *ptr =
s::malloc_shared(100, myQueue.get_device(), myQueue.get_context());
myQueue.submit([&](s::handler &cgh) {
cgh.single_task<class fractF1UF1>(
[=]() { Buf[0] = s::fract(float{1.5f}, &Buf[1]); });
Expand All @@ -34,6 +35,7 @@ int main() {
r = Buf[0];
i = Buf[1];
s::free(Buf, myQueue.get_context());
s::free(ptr, myQueue.get_context());
}
assert(r == 0.5f);
assert(i == 1.0f);
Expand Down

0 comments on commit e6d6a47

Please sign in to comment.