开发环境
Win7 VS2002 halcon12, 直接运行Debug的exe
宽高5000,单格1*1的棋盘占用内存
手动释放region regionConnect
private void butTemp_Click(object sender, EventArgs e)
{
butTemp.Enabled = false;
HOperatorSet.SetSystem("clip_region", "false");
{
HObject region;
HOperatorSet.GenCheckerRegion(out region, 5000, 5000, 1, 1);
HObject regionConnect;
HOperatorSet.Connection(region, out regionConnect);
region.Dispose();
regionConnect.Dispose();
}
butTemp.Enabled = true;
}
大约占用200M,两者的顺序不影响结果。
都不释放
private void butTemp_Click(object sender, EventArgs e)
{
butTemp.Enabled = false;
HOperatorSet.SetSystem("clip_region", "false");
{
HObject region;
HOperatorSet.GenCheckerRegion(out region, 5000, 5000, 1, 1);
HObject regionConnect;
HOperatorSet.Connection(region, out regionConnect);
//region.Dispose();
//regionConnect.Dispose();
}
butTemp.Enabled = true;
}
大约占350M
只释放region
private void butTemp_Click(object sender, EventArgs e)
{
butTemp.Enabled = false;
HOperatorSet.SetSystem("clip_region", "false");
{
HObject region;
HOperatorSet.GenCheckerRegion(out region, 5000, 5000, 1, 1);
HObject regionConnect;
HOperatorSet.Connection(region, out regionConnect);
region.Dispose();
//regionConnect.Dispose();
}
butTemp.Enabled = true;
}
大约占用200M
只释放regionConnect
private void butTemp_Click(object sender, EventArgs e)
{
butTemp.Enabled = false;
HOperatorSet.SetSystem("clip_region", "false");
{
HObject region;
HOperatorSet.GenCheckerRegion(out region, 5000, 5000, 1, 1);
HObject regionConnect;
HOperatorSet.Connection(region, out regionConnect);
// region.Dispose();
regionConnect.Dispose();
}
大约占用200M文章来源:https://www.toymoban.com/news/detail-693789.html
其它版本
换了halcol18 halcon12的 debug release都如此。
先释放regionConnect和先释放region 都如此。文章来源地址https://www.toymoban.com/news/detail-693789.html
到了这里,关于HOperatorSet.Connection 有内存泄漏或缓存的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!