QString::toStdString memory leak
-
Hi All, I am using the member function "toStdString" of QString class to convert QString to std string. Conversion is done correctly but I ran memcheck tool of valgrind to check the memory and I found that there are a lot of leaks existing due to the conversion using "toStdString".
Is it a known issue? and if yes, Is there a way to avoid using it and perform the same conversion? -
Hi, welcome to devnet
I just checked this on Windows with "VLD":https://vld.codeplex.com/ and can't confirm this.
Can you show an example of code that seems to leak? -
I've just coded this lines and valgrind didn't find any memory leak.
@
#include <QString>
#include <iostream>int main(int argc, char *argv[])
{
QString qstring("test");std::cout << qstring.toStdString() << std::endl; return 0;
}
@ -
Ok, many thanks Chris and tarod.net for your efforts.
It seems to be a false detection. -
Great! :)