From the manual page: "The reference count is not increased on the returned ISs", so you should not delete them
Note that the rule in PETSc is items obtained with a call that contains the work Create must destroy the object, if it contains Get then it should not destroy the object. Barry > On Jun 15, 2019, at 9:17 PM, tangqi via petsc-users <petsc-users@mcs.anl.gov> > wrote: > > Dear all, > > Do I need to delete index_set from MatNestGetISs? I get my index_set from > MatNestGetISs(P, index_set, NULL); //P is a nest matrix of 3x3 > > When I delete index_set later > for (int i=0; i<3; i++) > { > ISDestroy(&index_set[i]); > } > > It gives me error > [0]PETSC ERROR: --------------------- Error Message > -------------------------------------------------------------- > [0]PETSC ERROR: Invalid argument > [0]PETSC ERROR: Wrong type of object: Parameter # 1 > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for > trouble shooting. > [0]PETSC ERROR: Petsc Release Version 3.11.1, Apr, 12, 2019 > [0]PETSC ERROR: Unknown Name on a arch-linux2-c-debug named ba005.localdomain > by qtang Sat Jun 15 19:48:29 2019 > [0]PETSC ERROR: Configure options > --with-mpi-dir=/usr/projects/hpcsoft/toss3/badger/openmpi/2.1.2-gcc-7.4.0 > --download-hypre --with-cxx-dialect=C++11 > [0]PETSC ERROR: #1 ISDestroy() line 428 in > /turquoise/users/qtang/Software/petsc-3.11.1/src/vec/is/is/interface/index.c > > Thanks, > Qi