insertPlainText valgrind error.
-
Hey there,
I've recently started build a text editor using qt and c++.
The program as of now runs just fine.
I decided to run valgrind to handle leaks and i'm getting tons of error from
"insertPlainText" function i believe.
Function is called at the start after the Mode Object has been created.#include "../includes/Mode.h" #include "../includes/mainwindow.h" #include "ui_mainwindow.h" #include <qevent.h> /*@brief: iterates over given file and copy its content. * Content is copied inside iTextEdit. * This is needed to edit the file passed as parameter to main. */ void Mode::createFile() { QFile file(this->file); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return; while (!file.atEnd()) { Q_ASSERT(ui.iTextEdit); Q_ASSERT(ui.iTextEdit->document()); QByteArray line = file.readLine(); ui.iTextEdit->insertPlainText(QString::fromUtf8(line)); } sel_struct->tcurs.setPosition(QTextCursor::Start); ui.iTextEdit->setTextCursor(sel_struct->tcurs); file.close(); }
==21831== Invalid read of size 16 ==21831== at 0xC466325: ??? ==21831== by 0xB1B5DF7: ??? ==21831== Address 0xb1b5e5e is 126 bytes inside a block of size 140 alloc'd ==21831== at 0x4846828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==21831== by 0x570D0E9: QArrayData::allocate(unsigned long, unsigned long, unsigned long, QFlags<QArrayData::AllocationOption>) (in /usr/lib /x86_64-linux-gnu/libQt5Core.so.5.15.13) ==21831== by 0x578AC1B: QString::reallocData(unsigned int, bool) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.15.13) ==21831== by 0x519EB2E: QTextBlock::text() const (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.13) ==21831== by 0x520CC9A: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.13) ==21831== by 0x520CE5F: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.13) ==21831== by 0x5938DBE: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.15.13) ==21831== by 0x51A1F4F: QTextDocument::contentsChange(int, int, int) (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.13) ==21831== by 0x51BA780: QTextDocumentPrivate::finishEdit() (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.13) ==21831== by 0x51F326A: QTextCursor::insertText(QString const&, QTextCharFormat const&) (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.13) ==21831== by 0x51F431F: QTextCursor::insertText(QString const&) (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.13) ==21831== by 0x114AF3: Mode::createFile() (createfile.cpp:20) ==21831== ==21831== Conditional jump or move depends on uninitialised value(s) ==21831== at 0xC46633E: ??? ==21831== by 0xB1B5DF7: ???
(Pic to check line number)Any idea on why this is happening?
-
Hey there,
I've recently started build a text editor using qt and c++.
The program as of now runs just fine.
I decided to run valgrind to handle leaks and i'm getting tons of error from
"insertPlainText" function i believe.
Function is called at the start after the Mode Object has been created.#include "../includes/Mode.h" #include "../includes/mainwindow.h" #include "ui_mainwindow.h" #include <qevent.h> /*@brief: iterates over given file and copy its content. * Content is copied inside iTextEdit. * This is needed to edit the file passed as parameter to main. */ void Mode::createFile() { QFile file(this->file); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return; while (!file.atEnd()) { Q_ASSERT(ui.iTextEdit); Q_ASSERT(ui.iTextEdit->document()); QByteArray line = file.readLine(); ui.iTextEdit->insertPlainText(QString::fromUtf8(line)); } sel_struct->tcurs.setPosition(QTextCursor::Start); ui.iTextEdit->setTextCursor(sel_struct->tcurs); file.close(); }
==21831== Invalid read of size 16 ==21831== at 0xC466325: ??? ==21831== by 0xB1B5DF7: ??? ==21831== Address 0xb1b5e5e is 126 bytes inside a block of size 140 alloc'd ==21831== at 0x4846828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==21831== by 0x570D0E9: QArrayData::allocate(unsigned long, unsigned long, unsigned long, QFlags<QArrayData::AllocationOption>) (in /usr/lib /x86_64-linux-gnu/libQt5Core.so.5.15.13) ==21831== by 0x578AC1B: QString::reallocData(unsigned int, bool) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.15.13) ==21831== by 0x519EB2E: QTextBlock::text() const (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.13) ==21831== by 0x520CC9A: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.13) ==21831== by 0x520CE5F: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.13) ==21831== by 0x5938DBE: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.15.13) ==21831== by 0x51A1F4F: QTextDocument::contentsChange(int, int, int) (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.13) ==21831== by 0x51BA780: QTextDocumentPrivate::finishEdit() (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.13) ==21831== by 0x51F326A: QTextCursor::insertText(QString const&, QTextCharFormat const&) (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.13) ==21831== by 0x51F431F: QTextCursor::insertText(QString const&) (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.13) ==21831== by 0x114AF3: Mode::createFile() (createfile.cpp:20) ==21831== ==21831== Conditional jump or move depends on uninitialised value(s) ==21831== at 0xC46633E: ??? ==21831== by 0xB1B5DF7: ???
(Pic to check line number)Any idea on why this is happening?
@TON-618
Although I do not believe it should be necessary, try assigningQString::fromUtf8(line)
to a variable just in case there is some temporary allocation issue:QString str(QString::fromUtf8(line)); ui.iTextEdit->insertPlainText(str);
It should not make any difference to behaviour, but does it?
-
@TON-618
Although I do not believe it should be necessary, try assigningQString::fromUtf8(line)
to a variable just in case there is some temporary allocation issue:QString str(QString::fromUtf8(line)); ui.iTextEdit->insertPlainText(str);
It should not make any difference to behaviour, but does it?
@JonB Sadly didn't change much. Also tried to add checks for both textedit and the str itself. I think it has to do with the insertPlainText method but i don't know how i could fix that. As of now i think i'll just suppress the error from valgrind because it looks like the program works just fine.
-
@JonB Sadly didn't change much. Also tried to add checks for both textedit and the str itself. I think it has to do with the insertPlainText method but i don't know how i could fix that. As of now i think i'll just suppress the error from valgrind because it looks like the program works just fine.
@TON-618
I am Ubuntu 24.04, I think you are Linux too. I am the QT6 version which comes with 24.04, I think it's 6.4 or 6.5. What are you? I have always gotten on well with valgrind. Which options are you passing to it? Lemme try something close to yours usingQTextEdit
and see whether I get any issues.... -
Ubuntu version is the same, while qt version is this one according to the qmake command
Could this be something related to the version i am using?
@TON-618
Your Qt is old Qt5, which is totally different from current Qt6 in terms of how it might or might not behave under valgrind. Nonetheless I will test my Qt6 state FWIW.It is up to you, but if you are starting out using Qt you might want to restart with the upgrade/change to Qt6. Qt5 was fine per se, but it is "old" now. When you ask questions here people will tend to assume and answer for Qt6. There won't be any more updates for Qt5. If it's all the same to you I would get yourself moved to Qt6 (I stick to what
apt install
provides, I don't go to TQtC site) now before you start. Whether it will have any effect on the valgrind we don't know, though I'll try that in a few minutes and report back anyway.... -
Good to know. I used it 1 year ago and then dropped it.
I picked it up again only recently so that might be it. Waiting for your report and thanks for the fast answers :)@TON-618
Obviously I cannot type in exactly the same situation as you are in. But the following works fine for me, with no valgrind warnings on exit (other than the 6 "External errors" you always get if you don't switch that off in the filter, it starts switched off).#include <QApplication> #include <QTextEdit> int main(int argc, char *argv[]) { QApplication a(argc, argv); QTextEdit w; for (int i = 0; i < 10; i++) { QByteArray line(QByteArrayLiteral("Hello world!\n")); QString str(QString::fromUtf8(line)); w.insertPlainText(str); } w.show(); return a.exec(); }
You could try this under your Qt5 to see whether that barfs or it is something else in your real code.
If you are going to move to Qt6 do that soon and check in valgrind, there is no point worrying about Qt5.
-
@TON-618
Obviously I cannot type in exactly the same situation as you are in. But the following works fine for me, with no valgrind warnings on exit (other than the 6 "External errors" you always get if you don't switch that off in the filter, it starts switched off).#include <QApplication> #include <QTextEdit> int main(int argc, char *argv[]) { QApplication a(argc, argv); QTextEdit w; for (int i = 0; i < 10; i++) { QByteArray line(QByteArrayLiteral("Hello world!\n")); QString str(QString::fromUtf8(line)); w.insertPlainText(str); } w.show(); return a.exec(); }
You could try this under your Qt5 to see whether that barfs or it is something else in your real code.
If you are going to move to Qt6 do that soon and check in valgrind, there is no point worrying about Qt5.
@JonB thats what i get if i run the program you provided. Thats probably normal looking at the valgrind error. But yeah, at least i'm not getting the errors i get in my program. I'll surely upgrade to the newest version of qt and see what happens anyway since code might change the output in some ways.
==39617== realloc() with size 0 ==39617== at 0x484DB80: realloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==39617== by 0xD94DC1F: ??? (in /usr/lib/x86_64-linux-gnu/libnvidia-glcore.so.550.144.03) ==39617== by 0xCDEB986: ??? (in /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.550.144.03) ==39617== by 0xCE456D1: ??? (in /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.550.144.03) ==39617== by 0xCDEB012: ??? (in /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.550.144.03) ==39617== by 0x4005823: call_init (dl-init.c:120) ==39617== by 0x4005823: _dl_init (dl-init.c:121) ==39617== by 0x40015B1: _dl_catch_exception (dl-catch.c:211) ==39617== by 0x400CD7B: dl_open_worker (dl-open.c:829) ==39617== by 0x400CD7B: dl_open_worker (dl-open.c:792) ==39617== by 0x400151B: _dl_catch_exception (dl-catch.c:237) ==39617== by 0x400D163: _dl_open (dl-open.c:905) ==39617== by 0x5EDF1A3: dlopen_doit (dlopen.c:56) ==39617== by 0x400151B: _dl_catch_exception (dl-catch.c:237) ==39617== Address 0x8d26140 is 0 bytes after a block of size 0 alloc'd ==39617== at 0x4846828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==39617== by 0xD94DC0F: ??? (in /usr/lib/x86_64-linux-gnu/libnvidia-glcore.so.550.144.03) ==39617== by 0xCDEB986: ??? (in /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.550.144.03) ==39617== by 0xCE456D1: ??? (in /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.550.144.03) ==39617== by 0xCDEB012: ??? (in /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.550.144.03) ==39617== by 0x4005823: call_init (dl-init.c:120) ==39617== by 0x4005823: _dl_init (dl-init.c:121) ==39617== by 0x40015B1: _dl_catch_exception (dl-catch.c:211) ==39617== by 0x400CD7B: dl_open_worker (dl-open.c:829) ==39617== by 0x400CD7B: dl_open_worker (dl-open.c:792) ==39617== by 0x400151B: _dl_catch_exception (dl-catch.c:237) ==39617== by 0x400D163: _dl_open (dl-open.c:905) ==39617== by 0x5EDF1A3: dlopen_doit (dlopen.c:56) ==39617== by 0x400151B: _dl_catch_exception (dl-catch.c:237) ==39617== ==39617== posix_memalign() invalid size value: 0 ==39617== at 0x484E2E8: posix_memalign (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==39617== by 0xD94DC55: ??? (in /usr/lib/x86_64-linux-gnu/libnvidia-glcore.so.550.144.03) ==39617== by 0xCDEB986: ??? (in /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.550.144.03) ==39617== by 0xCE456D1: ??? (in /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.550.144.03) ==39617== by 0xCDEB012: ??? (in /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.550.144.03) ==39617== by 0x4005823: call_init (dl-init.c:120) ==39617== by 0x4005823: _dl_init (dl-init.c:121) ==39617== by 0x40015B1: _dl_catch_exception (dl-catch.c:211) ==39617== by 0x400CD7B: dl_open_worker (dl-open.c:829) ==39617== by 0x400CD7B: dl_open_worker (dl-open.c:792) ==39617== by 0x400151B: _dl_catch_exception (dl-catch.c:237) ==39617== by 0x400D163: _dl_open (dl-open.c:905) ==39617== by 0x5EDF1A3: dlopen_doit (dlopen.c:56) ==39617== by 0x400151B: _dl_catch_exception (dl-catch.c:237) ==39617== ==39617== ==39617== HEAP SUMMARY: ==39617== in use at exit: 145,595 bytes in 1,080 blocks ==39617== total heap usage: 136,759 allocs, 135,679 frees, 2,985,737,013 bytes allocated ==39617== ==39617== LEAK SUMMARY: ==39617== definitely lost: 176 bytes in 4 blocks ==39617== indirectly lost: 0 bytes in 0 blocks ==39617== possibly lost: 368 bytes in 1 blocks ==39617== still reachable: 145,051 bytes in 1,075 blocks ==39617== suppressed: 0 bytes in 0 blocks ==39617== Rerun with --leak-check=full to see details of leaked memory ==39617== ==39617== For lists of detected and suppressed errors, rerun with: -s ==39617== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
-
Hey there,
I've recently started build a text editor using qt and c++.
The program as of now runs just fine.
I decided to run valgrind to handle leaks and i'm getting tons of error from
"insertPlainText" function i believe.
Function is called at the start after the Mode Object has been created.#include "../includes/Mode.h" #include "../includes/mainwindow.h" #include "ui_mainwindow.h" #include <qevent.h> /*@brief: iterates over given file and copy its content. * Content is copied inside iTextEdit. * This is needed to edit the file passed as parameter to main. */ void Mode::createFile() { QFile file(this->file); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return; while (!file.atEnd()) { Q_ASSERT(ui.iTextEdit); Q_ASSERT(ui.iTextEdit->document()); QByteArray line = file.readLine(); ui.iTextEdit->insertPlainText(QString::fromUtf8(line)); } sel_struct->tcurs.setPosition(QTextCursor::Start); ui.iTextEdit->setTextCursor(sel_struct->tcurs); file.close(); }
==21831== Invalid read of size 16 ==21831== at 0xC466325: ??? ==21831== by 0xB1B5DF7: ??? ==21831== Address 0xb1b5e5e is 126 bytes inside a block of size 140 alloc'd ==21831== at 0x4846828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==21831== by 0x570D0E9: QArrayData::allocate(unsigned long, unsigned long, unsigned long, QFlags<QArrayData::AllocationOption>) (in /usr/lib /x86_64-linux-gnu/libQt5Core.so.5.15.13) ==21831== by 0x578AC1B: QString::reallocData(unsigned int, bool) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.15.13) ==21831== by 0x519EB2E: QTextBlock::text() const (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.13) ==21831== by 0x520CC9A: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.13) ==21831== by 0x520CE5F: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.13) ==21831== by 0x5938DBE: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.15.13) ==21831== by 0x51A1F4F: QTextDocument::contentsChange(int, int, int) (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.13) ==21831== by 0x51BA780: QTextDocumentPrivate::finishEdit() (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.13) ==21831== by 0x51F326A: QTextCursor::insertText(QString const&, QTextCharFormat const&) (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.13) ==21831== by 0x51F431F: QTextCursor::insertText(QString const&) (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.15.13) ==21831== by 0x114AF3: Mode::createFile() (createfile.cpp:20) ==21831== ==21831== Conditional jump or move depends on uninitialised value(s) ==21831== at 0xC46633E: ??? ==21831== by 0xB1B5DF7: ???
(Pic to check line number)Any idea on why this is happening?
@TON-618
P.S.
As a total aside, rather than reading line by line from the file and sending a line at a time toinsertPlainText()
you might find it's faster to just do a singleui.iTextEdit->insertPlainText(QString::fromUtf8(file.readAll()));
Though I probably would not do that if the file is likely to be, say, 1GB+ in size....
-
@JonB thats what i get if i run the program you provided. Thats probably normal looking at the valgrind error. But yeah, at least i'm not getting the errors i get in my program. I'll surely upgrade to the newest version of qt and see what happens anyway since code might change the output in some ways.
==39617== realloc() with size 0 ==39617== at 0x484DB80: realloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==39617== by 0xD94DC1F: ??? (in /usr/lib/x86_64-linux-gnu/libnvidia-glcore.so.550.144.03) ==39617== by 0xCDEB986: ??? (in /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.550.144.03) ==39617== by 0xCE456D1: ??? (in /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.550.144.03) ==39617== by 0xCDEB012: ??? (in /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.550.144.03) ==39617== by 0x4005823: call_init (dl-init.c:120) ==39617== by 0x4005823: _dl_init (dl-init.c:121) ==39617== by 0x40015B1: _dl_catch_exception (dl-catch.c:211) ==39617== by 0x400CD7B: dl_open_worker (dl-open.c:829) ==39617== by 0x400CD7B: dl_open_worker (dl-open.c:792) ==39617== by 0x400151B: _dl_catch_exception (dl-catch.c:237) ==39617== by 0x400D163: _dl_open (dl-open.c:905) ==39617== by 0x5EDF1A3: dlopen_doit (dlopen.c:56) ==39617== by 0x400151B: _dl_catch_exception (dl-catch.c:237) ==39617== Address 0x8d26140 is 0 bytes after a block of size 0 alloc'd ==39617== at 0x4846828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==39617== by 0xD94DC0F: ??? (in /usr/lib/x86_64-linux-gnu/libnvidia-glcore.so.550.144.03) ==39617== by 0xCDEB986: ??? (in /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.550.144.03) ==39617== by 0xCE456D1: ??? (in /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.550.144.03) ==39617== by 0xCDEB012: ??? (in /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.550.144.03) ==39617== by 0x4005823: call_init (dl-init.c:120) ==39617== by 0x4005823: _dl_init (dl-init.c:121) ==39617== by 0x40015B1: _dl_catch_exception (dl-catch.c:211) ==39617== by 0x400CD7B: dl_open_worker (dl-open.c:829) ==39617== by 0x400CD7B: dl_open_worker (dl-open.c:792) ==39617== by 0x400151B: _dl_catch_exception (dl-catch.c:237) ==39617== by 0x400D163: _dl_open (dl-open.c:905) ==39617== by 0x5EDF1A3: dlopen_doit (dlopen.c:56) ==39617== by 0x400151B: _dl_catch_exception (dl-catch.c:237) ==39617== ==39617== posix_memalign() invalid size value: 0 ==39617== at 0x484E2E8: posix_memalign (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==39617== by 0xD94DC55: ??? (in /usr/lib/x86_64-linux-gnu/libnvidia-glcore.so.550.144.03) ==39617== by 0xCDEB986: ??? (in /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.550.144.03) ==39617== by 0xCE456D1: ??? (in /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.550.144.03) ==39617== by 0xCDEB012: ??? (in /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.550.144.03) ==39617== by 0x4005823: call_init (dl-init.c:120) ==39617== by 0x4005823: _dl_init (dl-init.c:121) ==39617== by 0x40015B1: _dl_catch_exception (dl-catch.c:211) ==39617== by 0x400CD7B: dl_open_worker (dl-open.c:829) ==39617== by 0x400CD7B: dl_open_worker (dl-open.c:792) ==39617== by 0x400151B: _dl_catch_exception (dl-catch.c:237) ==39617== by 0x400D163: _dl_open (dl-open.c:905) ==39617== by 0x5EDF1A3: dlopen_doit (dlopen.c:56) ==39617== by 0x400151B: _dl_catch_exception (dl-catch.c:237) ==39617== ==39617== ==39617== HEAP SUMMARY: ==39617== in use at exit: 145,595 bytes in 1,080 blocks ==39617== total heap usage: 136,759 allocs, 135,679 frees, 2,985,737,013 bytes allocated ==39617== ==39617== LEAK SUMMARY: ==39617== definitely lost: 176 bytes in 4 blocks ==39617== indirectly lost: 0 bytes in 0 blocks ==39617== possibly lost: 368 bytes in 1 blocks ==39617== still reachable: 145,051 bytes in 1,075 blocks ==39617== suppressed: 0 bytes in 0 blocks ==39617== Rerun with --leak-check=full to see details of leaked memory ==39617== ==39617== For lists of detected and suppressed errors, rerun with: -s ==39617== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
-
valgrind ./program_name
Anyway even after changing qt version (6.9.1) i still get the same error, but it was something that had to be done. So not bad anyway, guess its something with my code at this point, even tho i'm just loading a file. I'll update this thread if i find a solution -
valgrind ./program_name
Anyway even after changing qt version (6.9.1) i still get the same error, but it was something that had to be done. So not bad anyway, guess its something with my code at this point, even tho i'm just loading a file. I'll update this thread if i find a solution@TON-618
Use the valgrind interface in Creator (assuming you are using that!), it's more integrated than external command line and suppresses external errors of which there are a few (6) which will always happen. Your last valgrind output looks like external stuff which should be ignored. Good luck with Qt :) -
@TON-618
Use the valgrind interface in Creator (assuming you are using that!), it's more integrated than external command line and suppresses external errors of which there are a few (6) which will always happen. Your last valgrind output looks like external stuff which should be ignored. Good luck with Qt :) -
@TON-618
This is not the format I see in any output. I just use Analyze > Valgrind Memory Analyzer from within Qt Creator. What are you doing?@JonB said in insertPlainText valgrind error.:
Analyze > Valgrind Memory Analyzer
Okay, i tried this and the error i was getting is not there anymore.
I just have some leaks and a conditional jump.Qt's valgrind command is definitely more complex than mine and is probably suppressing the errors i was getting.
"valgrind --child-silent-after-fork=yes --xml-socket=127.0.0.1:39305 --log-so cket=127.0.0.1:39049 --xml=yes --smc-check=stack --tool=memcheck --gen-suppressions=all --track-origins=yes --leak-check=summary --num-callers= 25 ./miniVim ../../srcs/main.cpp "
-
@JonB said in insertPlainText valgrind error.:
Analyze > Valgrind Memory Analyzer
Okay, i tried this and the error i was getting is not there anymore.
I just have some leaks and a conditional jump.Qt's valgrind command is definitely more complex than mine and is probably suppressing the errors i was getting.
"valgrind --child-silent-after-fork=yes --xml-socket=127.0.0.1:39305 --log-so cket=127.0.0.1:39049 --xml=yes --smc-check=stack --tool=memcheck --gen-suppressions=all --track-origins=yes --leak-check=summary --num-callers= 25 ./miniVim ../../srcs/main.cpp "
@TON-618
Yes, that is why I suggested you use the Creator one with whatever options it passes to valgrind, as (we presume!) they know what they are doing. I suggest you use this always, or at least look at the command line options it passes for your own use.Good that this makes your reported leak --- which I don't think ever existed/there is nothing you can do about it --- go away. It's nice to keep your valgrind runs totally clean :)
-
@TON-618
Yes, that is why I suggested you use the Creator one with whatever options it passes to valgrind, as (we presume!) they know what they are doing. I suggest you use this always, or at least look at the command line options it passes for your own use.Good that this makes your reported leak --- which I don't think ever existed/there is nothing you can do about it --- go away. It's nice to keep your valgrind runs totally clean :)
-