Results 1 to 8 of 8

Thread: QProcess doesn't start when memory consumption is too high

  1. #1
    Join Date
    Mar 2011
    Posts
    120
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default QProcess doesn't start when memory consumption is too high

    Hello all,

    I am using QProcess class in my application to start external processes and get the reply. Recently I am observing a peculiar case in which when the memory consumption by my application exceeds a particular limit QProcess fails to start throwing the error
    QProcess::FailedToStart
    But if the same process is started outside application (from command line) when the application is running with full memory usage, it starts and executes successfully.
    So what I concluded is that QProcess does some memory/resource check when the function
    Qt Code:
    1. QProcess::start(..)
    To copy to clipboard, switch view to plain text mode 
    is called.
    Is there anyway I can make QProcess skip this step?
    Or if not, then is there any alternative to QProcess for the above mentioned task? Start an external process from inside my application, keep a track of it's status and keep getting all the data sent by the process?


    -Thanks,
    bibhu

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QProcess doesn't start when memory consumption is too high

    It is very unlikely that QProcess does any kind of resource check. It is way more likely that your operating system is denying more resources to you program.

    Cheers,
    _

  3. #3
    Join Date
    Mar 2011
    Posts
    120
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QProcess doesn't start when memory consumption is too high

    Quote Originally Posted by anda_skoa View Post
    It is very unlikely that QProcess does any kind of resource check. It is way more likely that your operating system is denying more resources to you program.
    _
    Ok, so in that case how to deal with this situation keeping in my mind that I can't decrease the memory consumption of my program? Can I tell my OS to allocate more resources to my program?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QProcess doesn't start when memory consumption is too high

    Which operating system are we talking about?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Mar 2011
    Posts
    120
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QProcess doesn't start when memory consumption is too high

    I am using linux 2.6(embedded, arm) and qt version is 4.6.

  6. #6
    Join Date
    Nov 2013
    Location
    Earth
    Posts
    1
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QProcess doesn't start when memory consumption is too high

    Hi,
    i have the exactly same problem.
    Qt 4.6 is running on an embedded system (Linux 2.6.38, ARM926EJ-S).
    The error is: Resource error (fork failure): Cannot allocate memory
    Since fork makes (somewhat) a copy of the calling process, and my calling process is a bit "bigger", it fails athough there really should be enough free memory for the small shell script that should be called.
    Is there an alternative to QProcess that doesn't use fork (that way?)?
    Before i implemented QProcess i made a simple system call, but that is really dirty and i want to avoid that.

    Best Regards

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QProcess doesn't start when memory consumption is too high

    You can implement an external daemon that you can contact using some IPC mechanism that will fork itself into the process you want.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. The following user says thank you to wysota for this useful post:

    versat (29th January 2014)

  9. #8
    Join Date
    Mar 2011
    Posts
    120
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QProcess doesn't start when memory consumption is too high

    Quote Originally Posted by wysota View Post
    You can implement an external daemon that you can contact using some IPC mechanism that will fork itself into the process you want.
    Couldn't understand anything . Since i am a beginner so i don't have much idea regarding this. If you can give me a simple example then it would be really great.

Similar Threads

  1. Qt 4.6.3 QString and memory consumption
    By webquinty in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 10th April 2012, 15:45
  2. QString memory consumption
    By sicker in forum Newbie
    Replies: 1
    Last Post: 4th November 2011, 16:23
  3. QTreeView memory consumption
    By eyeofhell in forum Qt Programming
    Replies: 6
    Last Post: 19th November 2010, 01:04
  4. QSqlQueryModel and memory consumption
    By lunatic fringe in forum Qt Programming
    Replies: 3
    Last Post: 5th February 2010, 11:09
  5. Replies: 0
    Last Post: 17th November 2009, 21:19

Tags for this Thread

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.