I am having a problem with an application that I'm working on. I am fairly certain that it is a memory leak pertaining to bitmaps from my file. I've tried and tried to find the leak to no avail.
The application that I'm creating is essentially a go between for two other programs. The two programs are:
1. An online hosted game
2. A logic application that logs the past outcome of the game and provides suggestions for the next move
My application does the following:
1. Reads the current outcome of the game
2. Passes the information to the logic application and forces the logic app to update with a new suggestion
3. Based on the suggestion, interacts with the online game
The problem is that neither of these applications have any sort of API, and the only way that I can perform this is by strategically locating the applications on the same section of the screen during each play and comparing screen captures to the potential outcomes for each application.
I have my program working properly, except for the fact that after a certain number of iterations of playing the game, it breaks and throws a "Parameter is Not Valid" error when performing a routine screen capture. From looking online, I've found out that this is a generic error and most likely means that there is a memory leak. Further supporting the memory leak hypothesis is that if you Try...Catch the error and let the application continue to run, you will get an OutOfMemory error.
I've tried to eliminate this error through hours and hours of debugging, but I'm relatively new trying to catch these errors, and I can't find it.
I have attached two files:
1. The Action Form doc shows the code of the form that is performing the loop
2. The Helper Information doc shows the class structures and additional helper code
I would greatly appreciate your assistance in getting my code running correctly without errors. Also, I'd be happy to let anyone look at the source code if that helps in debugging the leak
P.S. I writing in VB.NET, using Framework 3.5, and running Windows XP. I've tried this on two computers and have the same problem so I don't think it is a hardware issue.