[Trilinos-Users] Usage of Epetra_RowMatrixTransposer

Heroux, Michael A maherou at sandia.gov
Tue Nov 11 09:44:33 MST 2008


Great.  I will make sure that the constructor of this class checks for a zero pointer in the future, so this kind of mistake can be caught.

Mike


On 11/11/08 10:35 AM, "andrea3.villa at mail.polimi.it" <andrea3.villa at mail.polimi.it> wrote:

Ok I've fixed the problem, I've made 2 mistakes:

1) The CreateTranspose function call the NEW operator on the pointer
Rcut. Therefore the line:
Epetra_CrsMatrix* Rcut = new Epetra_CrsMatrix(Copy,*mapXp,1);
is useless and creates a memory leak.

2) The destructor of the class Epetra_RowMatrixTransposer DELETEs the
memory pointed by Rcut. This creates a conflict with:
  delete Rcut

Thank you very much.
Andrea.





Citando "Heroux, Michael A" <maherou at sandia.gov>:

> Hi Andrea,
>
> Have you checked the return code on the call to CreateTranspose?
>
> Also, you should not need the "Rcut->FillComplete();" call since
> this is done for you when CreateTranspose is called.
>
> Finally, unless you know that Tcut has exactly 1 nonzero per row,
> you should not use a "1" for the third argument to the Rcut
> constructor.  Instead use a "0".
>
> If you cannot figure out the error and have a small test case, I am
> happy to look at it.
>
> Mike
>
>
> On 11/8/08 4:01 AM, "andrea3.villa at mail.polimi.it"
> <andrea3.villa at mail.polimi.it> wrote:
>
> Good morning.
> I have a problem using Epetra_RowMatrixTransposer. I'm running a test
> code like:
>
> Epetra_CrsMatrix* Rcut = new Epetra_CrsMatrix(Copy,*mapXp,1);
> Epetra_RowMatrixTransposer Traspositore(Tcut);
> Traspositore.CreateTranspose(false,Rcut);
> Rcut->FillComplete();
> delete Rcut;
>
> Where Tcut is an already filled FECrsMatrix. I get several
> segmentation fault problems. I've also used valgrind and it defines
> the last code line as: "Invalid free() / delete / delete[]". Did I use
> the Epetra_RowMatrixTransposer properly?
>
> Thank you very much.
> Andrea.
>
>
>
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov
> http://software.sandia.gov/mailman/listinfo/trilinos-users
>
>
>






_______________________________________________
Trilinos-Users mailing list
Trilinos-Users at software.sandia.gov
http://software.sandia.gov/mailman/listinfo/trilinos-users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://software.sandia.gov/mailman/private/trilinos-users/attachments/20081111/34ba4996/attachment.html 


More information about the Trilinos-Users mailing list