Results 1 to 2 of 2

Thread: Application very heavy for lots object

  1. #1
    Join Date
    Feb 2006
    Location
    New Delhi,India
    Posts
    226
    Thanks
    14
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Application very heavy for lots object

    Hi...

    My Application has become very heavy and is taking lots of memory because of my use of lots of Q3CanvasLine Objects..

    basically i want to draw 1000 canvas lines on a canvas...
    so what i did was this..

    CanvasDraw.cpp
    Qt Code:
    1. Q3CanvasLine **m_pCLineObjs;
    2.  
    3. //in class contructor
    4. m_pCLineObjs = new Q3CanvasLine*[1000];
    5.  
    6. // function -> drawLine()
    7. for(i=0;i<1000;i++)
    8. {
    9.  
    10. m_pCLineObjs[i] = new Q3CanvasLine(canvas);
    11. m_pCLineObjs[i]->setPoints(//points set here);
    12. m_pCLineObjs[i]->show();
    13.  
    14. }
    To copy to clipboard, switch view to plain text mode 

    After this i created 512 objects of the CanvasDraw class and then tried running the app... but then for each of the 512 objs it created 1000 lines... which makes in total 512 * 1000 lines being created making the application take hell lot of memory and making it very very heavy....

    Is it possible for me to create a single line object like Q3CanvasLine *m_pCLine and then call this 1000 times to create 1000 lines at different places...
    I tried somthing like this but then it was just creating one line at the last line points..

    OR is there any solution which can help me creating least number of line objects to create the line..

    Please help me out in this..

    Thanking you,

    with regards,
    Kapil
    All you have to decide is what to do with the time that is given to you

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Application very heavy for lots object

    If those lines only connect other objects, IMO you should draw them by hand without creating Q3CanvasLine.

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.