Excessive memory leak even after calling GC.Collect()

Hi,
not knowing neither .net, nor Opencvsharp, my answer might be of limited help, but there are still a few generic things you might do (in the worst case, it will reduce the possibilities when some else comes to help you) :

  1. I would check if the memory is really free for deletion (maybe you are still referencing it somewhere)
  2. check if garbage collector can properly delete these objects (do a simple infinite loop : just create an object, delete it as you do in your program, and run GC ; see if memory increases or not). If not, maybe you need to call some “release ressources” function
  3. If you have a memory profile (in C++ on linux there is valgrind memcheck, no idea for equivalents for .net on windows), then try to see where memory gets alocated
  4. try to get a minimal code to reproduce the issue : often doing this you find you problem, and if not, post it on the forum, and it will be far easier for others to spot you problem than without any code or with a huge codebase
1 Like