Page 1 of 1

[Solved] an "invisible" bug several years old (DLL related)

Posted: Sun Nov 20, 2022 8:01 pm
by Caronte3D
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 :shock:

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

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

Re: [Solved] an "invisible" bug several years old (DLL related)

Posted: Tue Nov 22, 2022 4:33 pm
by Oso
Caronte3D wrote: Sun Nov 20, 2022 8:01 pm 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...
Thanks for posting this, Caronte3D. I can well appreciate your satisfaction on finding that bug. I found a 20-year-old bug in an application recently, so I know the feeling after years of annoyance with it (a variable reused and not initialised :o ).

Re: [Solved] an "invisible" bug several years old (DLL related)

Posted: Wed Nov 23, 2022 9:43 am
by pendle
Good info thanks for sharing