What causes error " called on pointer returned from a mismatched allocation function"
-
In my program I'm seeing a few of the error below. There is no indication where in my program the error is, or what the problem is. It has something to do (I think) with using the wrong function to delete an object created with new. But I can't figure out anything beyond that.
Any ideas?
/opt/Qt/5.15.2/gcc_64/include/QtQml/qqmlprivate.h:166: warning: ‘static void QQmlPrivate::QQmlElement<T>::operator delete(void*, void*) [with T = GUIManager]’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete] /opt/Qt/5.15.2/gcc_64/include/QtQml/qqmlprivate.h: In function ‘void QQmlPrivate::createInto(void*) [with T = GUIManager]’: /opt/Qt/5.15.2/gcc_64/include/QtQml/qqmlprivate.h:166:37: warning: ‘static void QQmlPrivate::QQmlElement<T>::operator delete(void*, void*) [with T = GUIManager]’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete] 166 | void createInto(void *memory) { new (memory) QQmlElement<T>; } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ /opt/Qt/5.15.2/gcc_64/include/QtQml/qqmlprivate.h:166:37: note: returned from ‘void* operator new(std::size_t, void*)’
-
Hi,
You should add which version of gcc you are using.
-
I have the same problem when run Qt extended project example (GCC 11.1.0)
@ocgltd is your problem solved? -
It looks to me that something has allocated memory with operator new[] and used delete on it (or conversely allocated it using operator new and used delete[] on it). This is a warning not a fatal error.
Qt 5.15 reference versions on Linux are GCC 10 or lower. This looks like a warning (-Wmismatched-new-delete) that has become on by default under GCC 11.
-
It looks to me that something has allocated memory with operator new[] and used delete on it (or conversely allocated it using operator new and used delete[] on it). This is a warning not a fatal error.
Qt 5.15 reference versions on Linux are GCC 10 or lower. This looks like a warning (-Wmismatched-new-delete) that has become on by default under GCC 11.