From 48ab37fe516e5747277c89af3d0fd8cf0d7f45e0 Mon Sep 17 00:00:00 2001 From: sunwen Date: Wed, 14 Jun 2023 17:53:39 +0800 Subject: [PATCH] Fix memory leak. --- src/common/dataBlockCreation/getAscanBlock.cpp | 5 ++--- src/common/preprocessAscanBlock.cpp | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/dataBlockCreation/getAscanBlock.cpp b/src/common/dataBlockCreation/getAscanBlock.cpp index f8c5ab7..52265fc 100644 --- a/src/common/dataBlockCreation/getAscanBlock.cpp +++ b/src/common/dataBlockCreation/getAscanBlock.cpp @@ -61,7 +61,6 @@ AscanBlock Recon::getAscanBlock(Parser* aParser, const Aurora::Matrix& aMp, cons result.rlBlock = Matrix::fromRawData(rlBlockData, 1, numScans); result.rnBlock = Matrix::fromRawData(rnBlockData, 1, numScans); result.gainBlock = Matrix::fromRawData(gainBlockData, 1, numScans); - OneTasAScanData oenTasData = aParser->getOneTasAscanDataOfMotorPosition(1); auto tasIndices = aParser->getMetaData().getTasIndices(); auto receiverIndices = aParser->getMetaData().getReceiverIndices(); auto tasElementMapper = findTasAndElementIndex(tasIndices, receiverIndices, aRl, aRn); @@ -70,7 +69,7 @@ AscanBlock Recon::getAscanBlock(Parser* aParser, const Aurora::Matrix& aMp, cons { for(int slIndex=0; slIndexgetOneTasAscanDataOfMotorPosition(aSl[slIndex]); + OneTasAScanData oneTasData = aParser->getOneTasAscanDataOfMotorPosition(aSl[slIndex]); for(int snIndex=0; snIndexsearchAscanDataFromOneTasAscanDataOfMP(oenTasData, ElementIndex(GeometryIndex(aSn[snIndex])), TasElementIndex(tasIndices.get()[tasElementMapper[mapperIndex]], ElementIndex(GeometryIndex(receiverIndices.get()[tasElementMapper[mapperIndex]]))), mp); + AScanData ascan = aParser->searchAscanDataFromOneTasAscanDataOfMP(oneTasData, ElementIndex(GeometryIndex(aSn[snIndex])), TasElementIndex(tasIndices.get()[tasElementMapper[mapperIndex]], ElementIndex(GeometryIndex(receiverIndices.get()[tasElementMapper[mapperIndex]]))), mp); double* startPointer = ascanBlockData + numScansIndex * ascan.getAscanDataLength(); std::copy(ascan.get() ,ascan.get() + ascan.getAscanDataLength(), startPointer); //ascanBlockData += ascan.getAscanDataLength(); diff --git a/src/common/preprocessAscanBlock.cpp b/src/common/preprocessAscanBlock.cpp index 183a507..9cddf66 100644 --- a/src/common/preprocessAscanBlock.cpp +++ b/src/common/preprocessAscanBlock.cpp @@ -12,6 +12,7 @@ Aurora::Matrix Recon::preprocessAscanBlock(const Aurora::Matrix& aAscans, const { result = Aurora::convertfp16tofloat(ascanData, aAscans.getDimSize(0), aAscans.getDimSize(1)); } + delete [] ascanData; //暂不考虑实现二代逻辑 // if isfield(measInfo, 'Bandpassundersampling') && (measInfo.Bandpassundersampling == 1)