Page 1 of 1

segmentation fault while Storage::getData after SO

Posted: Sat Jun 04, 2016 7:49 am
by mariakrgrg
Hello,
after implementing Static Optimization and trying to store activations to a vector, I get "Segmentation fault".

Here is the loop where I get this error:

Code: Select all

    vector<Vector> acts;                        // activations
    Storage *as = so.getActivationStorage();
    int na = model.getActuators().getSize();
    acts.resize(states.getSize());

    // Store activations to out vector
    for (int row = 0; row<states.getSize(); row++)
        for (int i = 0; i<na; i++)
            as->getData(row, i, acts[i]);     
I noticed that it runs the first loop without error (row=0 and i=0) and in second loop (row=0 and i=1) i get the Segmentation fault.

Any ideas?

Re: segmentation fault while Storage::getData after SO

Posted: Wed Jun 08, 2016 5:13 pm
by jimmy
are you sure you have the dimension of the matrix correct?