On Mon, Dec 1, 2008 at 12:08 AM, Paul Bryan Roberts pbronline-wine@yahoo.co.uk wrote:
In mshtml, I count 7 dll reference count inc/dec pairs, including the server lock pair, in main.c, htmldoc.c and protocol.c I count 28 pairs of InterlockedDecrement / InterlockedIncrement calls around the creation / destruction of active objects throughout the dll. That would seem to imply 22 missing reference count inc/dec pairs.
I suspect Alexandre didn't commit my lame patch because he wants us to have a go at getting CanDLLUnloadNow right. Thanks for the analysis.
If I finish my script, it will report how many pairs are missing for which dlls and in which source files
That sounds quite handy.
which might help make a decision whether the take up Mike Hearn's suggestion of never unloading anything. Even that should involve work taking out the reference counts that are already there.
I have a feeling we're not quite in the "memory is free" era yet...
I do not see how the classic WinAPI regression tests can catch this kind of bug other than being a tautologous test of the creation/destruction all the known active objects. If Mike Hearn's suggestion is not taken up, the script might also be useful for regression test purposes.
Your script is doing static analysis ... maybe it should be integrated into http://people.redhat.com/mstefani/wine/smatch/ Making it a smatch rule might be easier than writing it from scratch. - Dan