After adding that line the problem gets fixed.

Regards,

Manuel

---

On 3/13/19 3:13 PM, Zhang, Junchao wrote:
Manuel,
  Could you try to add this line
     sbaij->free_imax_ilen = PETSC_TRUE;
 after line 2431 in /opt/PETSc_library/petsc-3.10.4/src/mat/impls/sbaij/seq/sbaij.c

 PS: Matt, this bug looks unrelated to my VecRestoreArrayRead_Nest fix.

--Junchao Zhang


On Wed, Mar 13, 2019 at 9:05 AM Matthew Knepley <knep...@gmail.com <mailto:knep...@gmail.com>> wrote:

    On Wed, Mar 13, 2019 at 9:44 AM Manuel Colera Rico via petsc-users
    <petsc-users@mcs.anl.gov <mailto:petsc-users@mcs.anl.gov>> wrote:

        Yes:

        [ 0]8416 bytes MatCreateSeqSBAIJWithArrays() line 2431 in
        /opt/PETSc_library/petsc-3.10.4/src/mat/impls/sbaij/seq/sbaij.c
        [ 0]8416 bytes MatCreateSeqSBAIJWithArrays() line 2431 in
        /opt/PETSc_library/petsc-3.10.4/src/mat/impls/sbaij/seq/sbaij.c
        [ 0]4544 bytes MatCreateSeqSBAIJWithArrays() line 2431 in
        /opt/PETSc_library/petsc-3.10.4/src/mat/impls/sbaij/seq/sbaij.c
        [ 0]4544 bytes MatCreateSeqSBAIJWithArrays() line 2431 in
        /opt/PETSc_library/petsc-3.10.4/src/mat/impls/sbaij/seq/sbaij.c


    Junchao, do imax and ilen get missed in the Destroy with the user
    provides arrays?

    
https://bitbucket.org/petsc/petsc/src/06a3e802b3873ffbfd04b71a0821522327dd9b04/src/mat/impls/sbaij/seq/sbaij.c#lines-2431

        Matt

        I have checked that I have destroyed all the MatNest matrices
        and all
        the submatrices individually.

        Manuel

        ---

        On 3/13/19 2:28 PM, Jed Brown wrote:
        > Is there any output if you run with -malloc_dump?
        >
        > Manuel Colera Rico via petsc-users <petsc-users@mcs.anl.gov
        <mailto:petsc-users@mcs.anl.gov>> writes:
        >
        >> Hi, Junchao,
        >>
        >> I have installed the newest version of PETSc and it works
        fine. I just
        >> get the following memory leak warning:
        >>
        >> Direct leak of 28608 byte(s) in 12 object(s) allocated from:
        >>       #0 0x7f1ddd5caa38 in __interceptor_memalign
        >>
        ../../../../gcc-8.1.0/libsanitizer/asan/asan_malloc_linux.cc:111
        >>       #1 0x7f1ddbef1213 in PetscMallocAlign
        >>
        
(/opt/PETSc_library/petsc-3.10.4/mcr_20190313/lib/libpetsc.so.3.10+0x150213)
        >>
        >> Thank you,
        >>
        >> Manuel
        >>
        >> ---
        >>
        >> On 3/12/19 7:08 PM, Zhang, Junchao wrote:
        >>> Hi, Manuel,
        >>>    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?
        >>>    Thanks.
        >>>
        >>> --Junchao Zhang
        >>>
        >>>
        >>> On Mon, Mar 11, 2019 at 6:56 AM Manuel Colera Rico via
        petsc-users
        >>> <petsc-users@mcs.anl.gov <mailto:petsc-users@mcs.anl.gov>
        <mailto:petsc-users@mcs.anl.gov
        <mailto:petsc-users@mcs.anl.gov>>> wrote:
        >>>
        >>>      Hello,
        >>>
        >>>      I need to solve a 2*2 block linear system. The
        matrices A_00, A_01,
        >>>      A_10, A_11 are constructed separately via
        >>>      MatCreateSeqAIJWithArrays and
        >>>      MatCreateSeqSBAIJWithArrays. Then, I construct the
        full system matrix
        >>>      with MatCreateNest, and use MatNestGetISs and
        PCFieldSplitSetIS to
        >>>      set
        >>>      up the PC, trying to follow the procedure described here:
        >>>
        
https://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex70.c.html.
        >>>
        >>>      However, when I run the code with Leak Sanitizer, I
        get the
        >>>      following error:
        >>>
        >>>
        =================================================================
        >>>      ==54927==ERROR: AddressSanitizer: attempting free on
        address which
        >>>      was
        >>>      not malloc()-ed: 0x627000051ab8 in thread T0
        >>>           #0 0x7fbd95c08f30 in __interceptor_free
        >>>
        ../../../../gcc-8.1.0/libsanitizer/asan/asan_malloc_linux.cc:66
        >>>           #1 0x7fbd92b99dcd in PetscFreeAlign
        >>>
        
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0x146dcd)
        >>>           #2 0x7fbd92ce0178 in VecRestoreArray_Nest
        >>>
        
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0x28d178)
        >>>           #3 0x7fbd92cd627d in VecRestoreArrayRead
        >>>
        
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0x28327d)
        >>>           #4 0x7fbd92d1189e in VecScatterBegin_SSToSS
        >>>
        
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0x2be89e)
        >>>           #5 0x7fbd92d1a414 in VecScatterBegin
        >>>
        
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0x2c7414)
        >>>           #6 0x7fbd934a999c in PCApply_FieldSplit
        >>>
        
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0xa5699c)
        >>>           #7 0x7fbd93369071 in PCApply
        >>>
        
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0x916071)
        >>>           #8 0x7fbd934efe77 in KSPInitialResidual
        >>>
        
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0xa9ce77)
        >>>           #9 0x7fbd9350272c in KSPSolve_GMRES
        >>>
        
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0xaaf72c)
        >>>           #10 0x7fbd934e3c01 in KSPSolve
        >>>
        
(/opt/PETSc_library/petsc/manuel_OpenBLAS_petsc/lib/libpetsc.so.3.8+0xa90c01)
        >>>
        >>>      Disabling Leak Sanitizer also outputs an "invalid
        pointer" error.
        >>>
        >>>      Did I forget something when writing the code?
        >>>
        >>>      Thank you,
        >>>
        >>>      Manuel
        >>>
        >>>      ---
        >>>



-- What most experimenters take for granted before they begin their
    experiments is infinitely more interesting than any results to
    which their experiments lead.
    -- Norbert Wiener

    https://www.cse.buffalo.edu/~knepley/
    <http://www.cse.buffalo.edu/~knepley/>

Reply via email to