Forum > General

"Ghost Lining"

<< < (3/3)


--- Quote from: MarkMLl on December 04, 2021, 08:53:57 am ---Also the fact that it apparently affects both Delphi and Lazarus, which can be reasonably expected to have different heap layouts.

BUT... that in itself is a valuable clue: it implies that it's something being done by the program itself, rather than by the linker or underlying libraries since if they were at fault the problem would be unlikely to manifest itself in the same way.


--- End quote ---
The most recent bug in my project, that was fixed - was exactly such bug, that was happening from time to time in release version, but almost never in debug one, so it was really hard to pinpoint it. After researching this problem, I determined, that problem was happening during CreateWindow. First I thought, that it was some sort of race condition in video driver due to video mode switch. It would have been weird, because old version of my project didn't have such problem. But then I realized, that problem was actually happening inside window proc, not CreateWindow itself. At the end I found, that it was caused by wrong window class, that was used to create temporary window. Each dll should have had it's own window class for this purpose. But due to error in window class name wrong one was used, that was causing creating window from other dll, that could have been unloaded. But it was some sort of race condition or this bug relied on dll load addresses, so that had never happened in debugger.

Another example of such floating bug - is forgetting to use ShareMem in Delphi, when it's required, that causes random crashes.


--- Quote from: RedOctober on December 03, 2021, 05:43:24 pm ---Just wondering if anyone else has run into this, and what, if anything, I am doing wrong, or not looking for that I should be looking for.

--- End quote ---

If you're sure that your own code is correct (see remarks of the others) you might want to compare the assembly output t you should ensure that the same optimization settings are used. You could also experiment with the various optimization settings.

--- Quote from: jamie on December 04, 2021, 11:52:50 am ---speaking of MAP files, how is that done in fpc ? Because I did that many times in Delphi so I could archive that file with the backups of releases. This was handy because I could reference an address in the file reported by a user to determine a general location of the error ..

--- End quote ---

The -Xm parameter asks the linker to generate a map file.


[0] Message Index

[*] Previous page

Go to full version