[Solved] an "invisible" bug several years old (DLL related)
Posted: Sun Nov 20, 2022 8:01 pm
Years ago I made a dll for a 3rd party application and I have endured an elusive bug for all that time without being able to catch it.
The bug caused the DLL (and the application) to get slower the more days they were running without restarting.
I was checking everything about the memory usage in my dll and was not able to find the bug at all in all these years, which forced me to incorporate a function that would force the application to restart every x days, poor solution, but it's the only way I found to avoid the extreme slowness that was reached with the days.
This Friday I found the culprit behind such a bug, so I'm sharing it here, because it's something that I at least didn't know about and that can drive anyone crazy.
The bug was that I had some global variable outside the function: "ProcedureDLL AttachProcess(Instance)" and ALL global variables must go in that function
So... remember to put ALL global variables in there
P.D: The info about that is from this video someone posted here on the forum:
https://youtu.be/JPQWQfDhICA
The bug caused the DLL (and the application) to get slower the more days they were running without restarting.
I was checking everything about the memory usage in my dll and was not able to find the bug at all in all these years, which forced me to incorporate a function that would force the application to restart every x days, poor solution, but it's the only way I found to avoid the extreme slowness that was reached with the days.
This Friday I found the culprit behind such a bug, so I'm sharing it here, because it's something that I at least didn't know about and that can drive anyone crazy.
The bug was that I had some global variable outside the function: "ProcedureDLL AttachProcess(Instance)" and ALL global variables must go in that function

So... remember to put ALL global variables in there

P.D: The info about that is from this video someone posted here on the forum:
https://youtu.be/JPQWQfDhICA