I am writing an image processing program in C ++. For this purpose, I changed a third-party program (edge detector) into a static library that I use in my program.
It smoothes the original edge detector, based on the OS, to clear the memory after performing the main function. Unfortunately, after I changed this original code, the main function became a “regular”, repeatedly called function, and therefore automatic cleaning is not performed. The result is a huge memory leak every time the function is called.
I cannot fully scan the entire detector code to fix this. Therefore, I would like to ask: in general, is there a way to separate the "subprogram" of the entire program (in my case, from the detector) from the rest and force the OS to clear after the subprogram, as if it were a stand-alone program? Could there be a solution using threads, for example?
Thank you for your responses.
source share