<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hi, Junchao,</p>
    <p>I have installed the newest version of PETSc and it works fine. I
      just get the following memory leak warning:</p>
    Direct leak of 28608 byte(s) in 12 object(s) allocated from:<br>
        #0 0x7f1ddd5caa38 in __interceptor_memalign
    ../../../../gcc-8.1.0/libsanitizer/asan/asan_malloc_linux.cc:111<br>
        #1 0x7f1ddbef1213 in PetscMallocAlign
(/opt/PETSc_library/petsc-3.10.4/mcr_20190313/lib/libpetsc.so.3.10+0x150213)<br>
    <p>Thank you,</p>
    <p>Manuel</p>
    <p>---<br>
    </p>
    <div class="moz-cite-prefix">On 3/12/19 7:08 PM, Zhang, Junchao
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CA+MQGp_wkEinEh6piEPmyA6z03V=dyyCTuWNz9A5FuXXnDTm9A@mail.gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>Hi, Manuel,</div>
          I recently fixed a problem in VecRestoreArrayRead. Basically,
        I added VecRestoreArrayRead_Nest. Could you try the master
        branch of PETSc to see if it fixes your problem?
        <div>  Thanks.<br>
          <div><br clear="all">
            <div>
              <div dir="ltr" class="gmail_signature"
                data-smartmail="gmail_signature">
                <div dir="ltr">--Junchao Zhang</div>
              </div>
            </div>
            <br>
          </div>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Mon, Mar 11, 2019 at 6:56
          AM Manuel Colera Rico via petsc-users <<a
            href="mailto:petsc-users@mcs.anl.gov" moz-do-not-send="true">petsc-users@mcs.anl.gov</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          Hello,<br>
          <br>
          I need to solve a 2*2 block linear system. The matrices A_00,
          A_01, <br>
          A_10, A_11 are constructed separately via
          MatCreateSeqAIJWithArrays and <br>
          MatCreateSeqSBAIJWithArrays. Then, I construct the full system
          matrix <br>
          with MatCreateNest, and use MatNestGetISs and
          PCFieldSplitSetIS to set <br>
          up the PC, trying to follow the procedure described here: <br>
          <a
href="https://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex70.c.html"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex70.c.html</a>.<br>
          <br>
          However, when I run the code with Leak Sanitizer, I get the
          following error:<br>
          <br>
=================================================================<br>
          ==54927==ERROR: AddressSanitizer: attempting free on address
          which was <br>
          not malloc()-ed: 0x627000051ab8 in thread T0<br>
               #0 0x7fbd95c08f30 in __interceptor_free <br>
../../../../gcc-8.1.0/libsanitizer/asan/asan_malloc_linux.cc:66<br>
               #1 0x7fbd92b99dcd in PetscFreeAlign <br>
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0x146dcd)<br>
               #2 0x7fbd92ce0178 in VecRestoreArray_Nest <br>
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0x28d178)<br>
               #3 0x7fbd92cd627d in VecRestoreArrayRead <br>
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0x28327d)<br>
               #4 0x7fbd92d1189e in VecScatterBegin_SSToSS <br>
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0x2be89e)<br>
               #5 0x7fbd92d1a414 in VecScatterBegin <br>
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0x2c7414)<br>
               #6 0x7fbd934a999c in PCApply_FieldSplit <br>
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0xa5699c)<br>
               #7 0x7fbd93369071 in PCApply <br>
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0x916071)<br>
               #8 0x7fbd934efe77 in KSPInitialResidual <br>
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0xa9ce77)<br>
               #9 0x7fbd9350272c in KSPSolve_GMRES <br>
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0xaaf72c)<br>
               #10 0x7fbd934e3c01 in KSPSolve <br>
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0xa90c01)<br>
          <br>
          Disabling Leak Sanitizer also outputs an "invalid pointer"
          error.<br>
          <br>
          Did I forget something when writing the code?<br>
          <br>
          Thank you,<br>
          <br>
          Manuel<br>
          <br>
          ---<br>
          <br>
        </blockquote>
      </div>
    </blockquote>
  </body>
</html>