Skip to content

Commit 2c326fc

Browse files
committed
DTensor<T>::allocateOnDevice: memento mori
1 parent 4198ecf commit 2c326fc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/tensor.cuh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,8 @@ inline void DTensor<T>::allocateOnDevice(size_t size, bool zero) {
849849
m_doDestroyPtrMatrices = true;
850850
cudaStatus = cudaMalloc(&m_d_ptrMatrices, numMats() * sizeof(T *));
851851
if (cudaStatus != cudaSuccess) {
852-
gpuErrChk(cudaFree(m_d_data));
852+
gpuErrChk(cudaFree(m_d_data)); // ... free previously allocated memory
853+
gpuErrChk(cudaStatus); // ... and memento mori
853854
}
854855
} else {
855856
m_doDestroyPtrMatrices = false;

0 commit comments

Comments
 (0)