Memory usage with QtQuick 2.0



  • Hi folks,

    I'm writing a QtQuick 2.0 plugin which needs to allocate a "quite large" chunk of memory ( ~ 800Mo ). This allocation fails (bad_alloc, and it's not the ctors' which is throwing as I'm allocing an array of chars).

    A reduced example would be :

    @
    class Bar : QQuickItem
    {
    Q_OBJECT

    public:
    Bar::Bar()
    {

        char *foo = NULL;
    
        foo = (char*) malloc(800000000);
        if (foo)
        {
            *foo = 5;
            qDebug() <<  "Working";
        }
    }
    

    };
    @

    (Forget correctness, I just want it to be concise, and I use malloc just for the example, but it doesn't matter).

    This won't print "Working" as the alloc fails and malloc returns NULL.

    This is on Windows XP 32 bit.

    With a Qt Executable such an allocation works (as expected), so I'm wondering if there is something in the QtQuick machinery which tends to eat all the virtual address space.

    Any idea?

    Thanks!



  • What are the things that you're going to do to at least help save money? College students need additional cash sometimes, and payday loans can help. While waiting on a paycheck from work, you may need to buy a brand new book last minute. Maybe you have to pay to print off a massive project. In any situation, you can get the help you need, so you can just stress about grades and not the money. Get more data at: "Payday Loan":https://personalmoneynetwork.com/payday-loans/



  • Hi Qurx,

    Don't you think that it could be a memory fragmentation issue ?

    I'll take a look to find a workaround but... you'll probably need to change your OS version.

    Bye


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.