Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Dynamic size matrix with QVarLengthArray

Dynamic size matrix with QVarLengthArray

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 533 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    marceloarguello700
    wrote on last edited by
    #1

    Hi i am making a software for stadistic calculus,
    then need to declare a matrix of given size
    it is declared only once time and dont resize during the process.

    Then need to create a matrix in the rangue of [1 to 10, 100 to 100.000] items.
    It only store doubles.

    In the begin process declare the matrix,populate with the numbers
    and make many calculus, not need to insert o delete items.
    Now i do:
    double matrix * = new double [dim1 * dim2];
    an when need the item (i,j) I do Aij = matrix[i*dim2+j];

    Then i have next-> FTH: (2336): *** Fault tolerant heap shim applied to current process. This is usually due to previous crashes. ***

    After reading some post, i see that matrix is stored in the heap.
    As can give me some problem.
    Question:

    1. Someone can tell me wich problems?

    Reading the doc i see that QVarLengthArray allocates the declared size of
    elements on the stack then grow up on the heap.
    If use QVarLengthArray, all elements will be in heap

    Question:
    2) QVarLengthArray will be a better choice o use std::vector with reserve() or which other?

    1. To avoid write on copy, how must to use QVarLengthArray,
      wit a pointer or with instance:

    QVarLengthArray * ptVLA;
    QVarLengthArray VLA;

    May be are basic question but i need high performance in my program
    Greetings

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved