clreleasecontex cause segment fault

I have a simple class which has the member cl::device, cl::context, cl::command_queue. This class is implemented as a singleton. When program finish, its destructor is called. At this time, it causes  segment fault. I find this crash produced by clreleasecontext. Example code likes as follows and I test in Mali-G76

class CLSingleton

{

static CLSingleton & get()

{

std::vector<cl::Platform> platforms;
cl::Platform::get(&platforms);
cl::Platform platform = platforms[0];
std::vector<cl::Device> devices;
platforms.getDevices(CL_DEVICE_TYPE_GPU, &devices);
_device = devices[0];
cl_context_properties properties[] = {
CL_CONTEXT_PLATFORM,
reinterpret_cast<cl_context_properties>(platform()),
0
};
_context = cl::Context(_device, properties);
_command_queue = cl::CommandQueue(_context, _device);

}

~CLSingleton() = default;

private:

CLSingleton();

cl::Device _device;

cl::Context _context;

cl::CommandQueue _command_queue;

}

int main()

{

CLSingleton().get();

return 0;

}

Parents Reply Children
No data
More questions in this forum