开发环境
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);
}
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();
}
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
其它版本
换了halcol18 halcon12的 debug release都如此。
先释放regionConnect和先释放region 都如此。