deviceFreeAndSetNil frees the specified device pointer if it's not null and set the pointer it holds to null.
(dp *devicePointer)
| 124 | |
| 125 | // deviceFreeAndSetNil frees the specified device pointer if it's not null and set the pointer it holds to null. |
| 126 | func deviceFreeAndSetNil(dp *devicePointer) { |
| 127 | if dp != nil && !dp.isNull() && dp.allocated { |
| 128 | getDeviceAllocator().deviceFree(*dp) |
| 129 | *dp = nullDevicePointer |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | func reportAllocatedMemory(deviceCount int, da deviceAllocator) { |
| 134 | // getAllocatedMemory may panic, therefore we should recover here |
no test coverage detected