Release allocated memory on the device and do some verification of code parameters according to device properties