diff --git a/contrib/PyCuAmpcor/src/cuAmpcorChunk.cpp b/contrib/PyCuAmpcor/src/cuAmpcorChunk.cpp index 9d69e6d23..71f50884d 100644 --- a/contrib/PyCuAmpcor/src/cuAmpcorChunk.cpp +++ b/contrib/PyCuAmpcor/src/cuAmpcorChunk.cpp @@ -603,6 +603,55 @@ cuAmpcorChunk::cuAmpcorChunk(cuAmpcorParameter *param_, GDALImage *reference_, G // destructor cuAmpcorChunk::~cuAmpcorChunk() { + corrNormalizerOverSampled.release(); + corrNormalizerRaw.release(); + + if(param->oversamplingMethod) { + delete corrSincOverSampler; + } + else { + delete corrOverSampler; + } + if(param->algorithm == 0) { + delete cuCorrFreqDomain; + delete cuCorrFreqDomain_OverSampled; + } + + delete ChunkOffsetDown ; + delete ChunkOffsetAcross ; + delete c_referenceBatchRaw; + delete c_secondaryBatchRaw; + delete r_referenceBatchRaw; + delete r_secondaryBatchRaw; + delete c_secondaryBatchZoomIn; + delete c_referenceBatchOverSampled; + delete c_secondaryBatchOverSampled; + delete r_referenceBatchOverSampled; + delete r_secondaryBatchOverSampled; + delete referenceBatchOverSampler; + delete secondaryBatchOverSampler; + + delete r_corrBatchRaw; + delete r_corrBatchZoomIn; + delete r_corrBatchZoomInAdjust; + delete r_corrBatchZoomInOverSampled; + delete offsetInit; + delete offsetZoomIn; + delete offsetFinal; + delete maxLocShift; + delete corrMaxValue; + + delete r_corrBatchRawZoomIn; + delete i_corrBatchZoomInValid; + delete r_corrBatchSum; + delete i_corrBatchValidCount; + delete i_maxloc; + delete r_maxval; + delete r_snrValue; + delete r_covValue; + + // end of deletions + } // end of file diff --git a/contrib/PyCuAmpcor/src/cuAmpcorController.cpp b/contrib/PyCuAmpcor/src/cuAmpcorController.cpp index 19518ea8f..0b08f433f 100644 --- a/contrib/PyCuAmpcor/src/cuAmpcorController.cpp +++ b/contrib/PyCuAmpcor/src/cuAmpcorController.cpp @@ -168,8 +168,9 @@ void cuAmpcorController::runAmpcor() for (int ist=0; istnStreams; ist++) { - checkCudaErrors(cudaStreamDestroy(streams[ist])); + // cufftplan etc are stream dependent, need to be deleted before stream is destroyed delete chunk[ist]; + checkCudaErrors(cudaStreamDestroy(streams[ist])); } delete referenceImage;