Skip to content

Commit

Permalink
Manually freeing CUDA memory
Browse files Browse the repository at this point in the history
  • Loading branch information
TomaszTB committed Feb 27, 2025
1 parent 34baa22 commit d7205fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public GpuMat update(GpuMat latestGlobalHeightMap)
CUDATools.checkCUDAError(error);

currentIndex = (currentIndex + 1) % layers;
return latestGlobalHeightMap;
return latestGlobalHeightMap.clone();
}

GpuMat result = new GpuMat(rows, cols, opencv_core.CV_16UC1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,11 @@ public void update(RigidBodyTransform sensorToWorldTransform, RigidBodyTransform
CUDATools.checkCUDAError(error);

if (heightMapParameters.getEnableAlphaFilter())
globalHeightMapImage = filteredRapidHeightMapExtractor.update(globalHeightMapImage);
{
GpuMat filteredHeightMap = filteredRapidHeightMapExtractor.update(globalHeightMapImage);
globalHeightMapImage.close();
globalHeightMapImage = filteredHeightMap;
}

// Run the cropping kernel
croppingKernel.withPointer(globalHeightMapImage.data()).withLong(globalHeightMapImage.step());
Expand Down

0 comments on commit d7205fb

Please sign in to comment.