[Qt-interest] help tracking down memory corruption on Mac Qt 4.7.3 Cocoa (64 bit)
Paul Miller
paul at fxtech.com
Tue May 24 16:41:29 CEST 2011
On 5/24/2011 9:34 AM, Konrad Rosenbaum wrote:
> On Tue, May 24, 2011 15:44, Paul Miller wrote:
>> Thanks Dair for suggesting valgrind - it helped me narrow down the
>> problem.
>>
>> Valgrind reported several invalid writes to bools I had in a widget
>> subclass. It reported them as writes after an allocation of a certain
>> size. I guess the compiler was not aligning them properly or not
>> computing the size of the memory allocation for the class properly. I
>> moved the bool variables to the top of the list of member variables and
>> the problem went away. valgrind no longer reports invalid writes.
>>
>> This problem didn't exist on Windows, nor in 32 bit mode on Mac, so I
>> suspect a bug in the 64 bit compiler. Unfortunately this happened with
>> gcc 4.2 and llvm 1.7. Spent literally 2 days tracking this one down. :-(
>
> Since it is quite unlikely that the same problem occurs in two different
> compilers on one platform but not in the same compile on a different
> platform, I suspect something else:
>
> do a "make clean" and then a full "make" - I'd bet the problem goes away.
> If I'm right you still have this problem, you just shifted it slightly to
> other properties or to the next time you change a class.
...
Konrad - that would be worth looking into except I am building with
XCode. This is the first thing I thought of, because I've seen this kind
of thing before (a *LONG* time ago, when using make), but not since
using Visual Studio and XCode for my builds. When I change the header, I
always see the "compiling X/Y files" message and the number is correct -
it's rebuilding all of the files that depend on the header.
Also, when switching architectures (I did a lot of switching back and
forth between 32 and 64 bit build environments), or swapping out Qt
locations, the entire project would get rebuilt, and I was consistently
getting this problem, even after knowing every file got rebuilt.
More information about the Qt-interest-old
mailing list