Results 1 to 2 of 2

Thread: Memory leak in QRegExpValidator?!?

  1. #1
    Join Date
    Feb 2008
    Posts
    79
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Memory leak in QRegExpValidator?!?

    Ok, I have a problem that is driving me crazy and I cannot find a way to fix it. In my header I have these declarations:
    Qt Code:
    1. QRegExpValidator* validatorFloat;
    2. QRegExpValidator* validatorCenaNaEnoto;
    3. QRegExpValidator* validatorZadnjiZnakSifre;
    To copy to clipboard, switch view to plain text mode 
    In source file I have this code:
    Qt Code:
    1. validatorZadnjiZnakSifre=new QRegExpValidator(this);
    2. validatorZadnjiZnakSifre->setRegExp(QRegExp("[0-9A-Za-z]"));
    3. ui->ZadnjiZnakSifreEdit->setValidator(validatorZadnjiZnakSifre);
    4. validatorCenaNaEnoto=new QRegExpValidator(this);
    5. validatorCenaNaEnoto->setRegExp(QRegExp("[0-9]{1,6}[.,]{0,1}[0-9]{0,2}"));
    6. ui->CenaNaEnotoEdit->setValidator(validatorCenaNaEnoto);
    7. validatorFloat=new QRegExpValidator(this);
    8. validatorFloat->setRegExp(QRegExp("[0-9]{1,10}[.,]{0,1}[0-9]{0,6}"));
    9. ui->FaktorPretvorbeEnotEdit->setValidator(validatorFloat);
    10. ui->KolicinaEdit->setValidator(validatorFloat);
    To copy to clipboard, switch view to plain text mode 
    When exiting program I get this message in debugger:
    Qt Code:
    1. Heap block at 095C6DE0 modified at 095C6E24 past requested size of 3c
    To copy to clipboard, switch view to plain text mode 

    When I comment out above mentioned lines in source file, then I dont get these message. How can I solve this problem? I tried all approaches that I can think of, but nothing helps. Is there a memory leak in Qt 4.6?

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Memory leak in QRegExpValidator?!?

    start by commenting one variable (and its use) at a time from the whole section.
    This way you will locate the variable which causes the problem.
    Then, we can look further.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. setWindowIcon memory leak?
    By Romi in forum Qt Programming
    Replies: 0
    Last Post: 25th December 2009, 16:43
  2. Replies: 0
    Last Post: 23rd December 2009, 13:53
  3. memory leak question
    By cool_qt in forum General Programming
    Replies: 3
    Last Post: 20th January 2009, 07:49
  4. Memory leak weirdness
    By Darhuuk in forum General Programming
    Replies: 10
    Last Post: 10th January 2008, 18:51
  5. Memory Leak in my Application :-(
    By Svaths in forum Qt Programming
    Replies: 4
    Last Post: 27th July 2007, 19:42

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.