The NASA scientists are waiting for you to solve the problem. They bring you a cappuccino, but then it reminds you of your exhausting work with the FBI agents. You prefer an orange juice!
Now, we are going to force the garbage collection service to free unused resources before running the algorithm on each image. This way, the memory consumption will not increase after each image is processed, and we will avoid the possibility of the garbage collection service being executed automatically in the middle of the intensive multithreaded code:
for (liThreadNumber = 0; liThreadNumber < priProcessorCount; liThreadNumber++)