修复BasePresenter释放点云时存在有内存未释放

This commit is contained in:
yiyi 2026-04-05 18:16:34 +08:00
parent eb1f09d6d4
commit 0ce34e3937
5 changed files with 46 additions and 21 deletions

View File

@ -5,7 +5,7 @@
#define HOLEDETECTION_APP_NAME "孔洞检测"
// 版本字符串
#define HOLEDETECTION_VERSION_STRING "1.1.3"
#define HOLEDETECTION_VERSION_STRING "1.1.4"
#define HOLEDETECTION_BUILD_STRING "1"
#define HOLEDETECTION_FULL_VERSION_STRING "V" HOLEDETECTION_VERSION_STRING "_" HOLEDETECTION_BUILD_STRING

View File

@ -1,8 +1,12 @@
# 1.1.4 2026-04-05
## build_1
1. 修复 释放点云内存的问题
# 1.1.3 2026-04-05
## build_1
1. 更新算法 1.0.1
# 1.1.2 2026-04-02
## build_1
1. 更新算法

View File

@ -39,6 +39,9 @@ BasePresenter::~BasePresenter()
// 停止检测线程
StopAlgoDetectThread();
// 释放检测数据缓存中的动态内存
ClearDetectionDataCache();
// 停止重连定时器
StopCameraReconnectTimer();
@ -576,6 +579,25 @@ void BasePresenter::StopAlgoDetectThread()
void BasePresenter::ClearDetectionDataCache()
{
std::lock_guard<std::mutex> lock(m_detectionDataMutex);
// 释放每个 SVzLaserLineData 中动态分配的 p3DPoint 和 p2DPoint
// _StaticDetectionCallback 中通过 new[] 分配,此处必须 delete[]
for (auto& pair : m_detectionDataCache) {
EVzResultDataType dataType = pair.first;
SVzLaserLineData& lineData = pair.second;
if (dataType == keResultDataType_Position) {
delete[] static_cast<SVzNL3DPosition*>(lineData.p3DPoint);
delete[] static_cast<SVzNL2DPosition*>(lineData.p2DPoint);
} else if (dataType == keResultDataType_PointXYZRGBA) {
delete[] static_cast<SVzNLPointXYZRGBA*>(lineData.p3DPoint);
delete[] static_cast<SVzNL2DLRPoint*>(lineData.p2DPoint);
}
lineData.p3DPoint = nullptr;
lineData.p2DPoint = nullptr;
}
m_detectionDataCache.clear();
LOG_DEBUG("[BasePresenter] 检测数据缓存已清空\n");
}

View File

@ -2,22 +2,21 @@
## 软件对应关系表
| 项目名称 | App名称 | 版本 |
|:--------|:---------|:------------|
| 自动拆包 | GrabBag | 1.3.6.2 |
| 皮带撕裂 | BeltTearingServer | 2.0.8.1 |
| 焊接 | LapWeld | 1.0.0.1 |
| 工件定位 | Workpiece | 1.0.3.0 |
| 颗粒尺寸检测 | ParticleSize | 1.0.0.0 |
| 双目标记检测 | BinocularMarkServer | 1.0.0.4 |
| 工件项目 | WorkpieceProject | 无 |
| 铁路隧道槽道测量 | TunnelChannel | 1.0.0.3 |
| 车轮拱高测量 | WheelMeasure | 1.0.2.1 |
| 螺杆定位 | ScrewPosition | 1.0.0.1 |
| 包裹拆线位置定位 | BagThreadPosition | 1.0.0.4 |
| 工件孔定位 | WorkpieceHole | 1.0.3.0 |
| 定子定位 | StatorPosition | 1.0.0.1 |
| 孔洞检测 | HoleDetection | 1.1.3.1 |
| 坑孔定位 | HolePitPosition | 无 |
| 棒材定位 | RodAndBarPosition | 1.0.2.1 |
| 序号 | 项目名称 | App名称 | 版本 |
|:---:|:--------|:---------|:------------|
| 1 | 自动拆包 | GrabBag | 1.3.6.2 |
| 2 | 皮带撕裂 | BeltTearingServer | 2.0.8.1 |
| 3 | 孔洞检测 | HoleDetection | 1.1.3.1 |
| 4 | 棒材定位 | RodAndBarPosition | 1.0.2.1 |
| 5 | 车轮拱高测量 | WheelMeasure | 1.0.2.1 |
| 6 | 定子定位 | StatorPosition | 1.0.0.1 |
| 7 | 焊接 | LapWeld | 1.0.0.1 |
| 8 | 工件定位 | Workpiece | 1.0.3.0 |
| 9 | 颗粒尺寸检测 | ParticleSize | 1.0.0.0 |
| 10 | 双目标记检测 | BinocularMarkServer | 1.0.0.4 |
| 11 | 铁路隧道槽道测量 | TunnelChannel | 1.0.0.3 |
| 12 | 螺杆定位 | ScrewPosition | 1.0.0.1 |
| 13 | 包裹拆线位置定位 | BagThreadPosition | 1.0.0.4 |
| 14 | 工件孔定位 | WorkpieceHole | 1.0.3.0 |
| 16 | 坑孔定位 | HolePitPosition | 无 |

2
Utils

@ -1 +1 @@
Subproject commit 5e978eaea4f7891cc2f4a9ac871598cbb3178f50
Subproject commit c98aa7b5d6729922879e95f6c1403ae7405136ba