According to Barry&#39;s advice, I use Valgrind to check my codes. I find there is an problem in MatTranspose_MPIDense(). It breaks my codes. The following is the information. could you give me some advice? thanks a lot<br>
==5821==<br>==5821== Invalid read of size 4<br>==5821==    at 0x5143617: MatGetSubMatrix_MPIDense(_p_Mat*, _p_IS*, _p_IS*, int, MatReuse, _p_Mat**) (mpidense.c:251)<br>==5821==    by 0x50C2D71: MatGetSubMatrix(_p_Mat*, _p_IS*, _p_IS*, int, MatReuse, _p_Mat**) (matrix.c:5744)<br>
==5821==    by 0x805BCE8: mySystem::MakeA(int) (mySystem.C:518)<br>==5821==    by 0x80615A6: mySystem::Source(mySystem*, int) (mySystem.C:1927)<br>==5821==    by 0x806B5B1: main (myproject.C:293)<br>==5821==  Address 0x8f06c64 is 12 bytes after a block of size 472,272 alloc&#39;d<br>
==5821==    at 0x401AC01: malloc (vg_replace_malloc.c:207)<br>==5821==    by 0x558312D: PetscMallocAlign(unsigned int, int, char const*, char const*, char const*, void**) (mal.c:40)<br>==5821==    by 0x558DA83: PetscTrMallocDefault(unsigned int, int, char const*, char const*, char const*, void**) (mtr.c:194)<br>
==5821==    by 0x50386A7: MatSeqDenseSetPreallocation_SeqDense (dense.c:1875)<br>==5821==    by 0x5038469: MatSeqDenseSetPreallocation(_p_Mat*, double*) (dense.c:1858)<br>==5821==    by 0x514BC4B: MatMPIDenseSetPreallocation_MPIDense (mpidense.c:1175)<br>
==5821==    by 0x514C889: MatMPIDenseSetPreallocation(_p_Mat*, double*) (mpidense.c:1312)<br>==5821==    by 0x514AD8B: MatTranspose_MPIDense(_p_Mat*, _p_Mat**) (mpidense.c:979)<br>==5821==    by 0x50B2D85: MatTranspose(_p_Mat*, _p_Mat**) (matrix.c:3603)<br>
==5821==    by 0x805BCAA: mySystem::MakeA(int) (mySystem.C:514)<br>==5821==    by 0x80615A6: mySystem::Source(mySystem*, int) (mySystem.C:1927)<br>==5821==    by 0x806B5B1: main (myproject.C:293)<br><br>Regards,<br>Yujie<br>
<br>