[Qt-interest] On overriding qMalloc in QVector
Benoit Jacob
jacob.benoit.1 at gmail.com
Thu Oct 22 01:12:09 CEST 2009
Hi guys, trolls, and all other species.
After a user reported a crash, I realized that if I want to use
QVector on types that require a custom allocator (in my case, require
128bit alignment), then just redefining qMalloc/qRealloc is not
enough. The problem is that QVectorData::malloc() gets compiled into
the Qt binary library and consequently doesn't honor my custom
qMalloc.
Now I can't reproduce his crash but my best understanding is that the
solution is for me to also redefine QVectorData::malloc().
I'm pleading that I shouldn't have had to examine Qt source code so
closely to do something that is a standard feature e.g. in the STL!
So, this is to learn your thoughts on this matter. I'd like to learn
if I'm missing something; otherwise i'd like to suggest that it's
important to provide a good solution for people who have to use custom
allocators.
Thanks,
Benoit
More information about the Qt-interest-old
mailing list