-
Notifications
You must be signed in to change notification settings - Fork 550
Description
NOTE: This issue is the same as the closed one from here: #3607
I opened it because unfortunately the solution was irrelevant. I provide extra info here which may help. Thank you!
I get crashes when deleting the cl_mem returned by the device<cl_mem>(). Either manually deleting it or when it is deleted by a smart pointer. This happens only with DEBUG build.
Description
I am using ArrayFire 3.9.0 (latest as of now), Windows 11 and OpenCL backend.
NOTE: The culprit is this: if we change the MSVC compiler switch for Runtime Library from /MD to /MDd (or even /MTd). That's when the CRT checks the heap for corruptions and crashes....I suspect it may also be a CRT bug but I am not sure..
Reproducible Code and/or Steps
To reproduce it is very simple on my machine! I run the DEBUG build (I am using visual studio with ), and it crashes with this code below:
int main(void)
{
af::array t = af::randu(2160, 3840);
af::sync();
std::unique_ptr<cl_mem> ptr(t.device<cl_mem>());
...(ptr goes out of scope) -> CRASH
}
of course it crashes with any other variations, like:
int main(void)
{
af::array t = af::randu(2160, 3840);
af::sync();
cl_mem* ptr = t.device<cl_mem>();
...(code here)...
delete ptr -> CRASH
}
I have tried to put af::sync() after the device<cl_mem>() call but the result is the same.
System Information
-
ArrayFire version
ArrayFire 3.9.0 -
Devices installed on the system
AMD gfx1036
NVIDIA RTX 4070 Super 12GB [1]
- [ X ] Using the latest available ArrayFire release
- [ X ] GPU drivers are up to date

