Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

VBAI 2011 dotnetAPI Memory Problem

Solved!
Go to solution

Hello,

 

im using VBAI2011 and want to show the Inspection Image in dotnet.

I found an Example in "Vision Builder AI 2011\API Examples\dotNET Examples\" this works for me, but i have an problem with growing memory usage.

You can reproduce the effect simply by starting the example and open one of the VBAI Example Inspections, every time you hit the Inspect button the used memory grows till there is no free memory left.

 

I tried to start the dotnet garbage collection manually with GC.collect() but this only frees the working set memory, the private bytes reservd by the dotnet application still growing.

 

Im Using VS2008 on WinXP 32bit, maybe someone had the same problem and have an solution for me.

Thanks in advance !

 

hw

0 Kudos
Message 1 of 3
(2,947 Views)
Solution
Accepted by topic author HWeisert

Thanks for the information. I will look into this. In the mean time, it looks like adding:

if (image != null)

   image.Dispose();

 

right before the GetInspectionImage call fixes the memory leak.

 

Hope this helps,

Brad

Message 2 of 3
(2,942 Views)

Works for me now!

 

But i had to change something more.

 

if (image != null)

   image.Dispose();

only works if "image" is not declared locally in inspect_Click like in the example!

 

Thanks,for the fast response!

0 Kudos
Message 3 of 3
(2,939 Views)