<div dir="ltr">I don't have a specific case yet. Currently every call of PETSc is checked. If ierr is not zero, print the error and return. For example,<div>
Mat A; /* problem matrix */ </div><div> EPS eps; /* eigenproblem solver context */ </div><div> EPSType type; </div><div> PetscReal error,tol,re,im; </div><div> PetscScalar kr,ki;
Vec xr,xi;
25 </div><div> PetscInt n=30,i,Istart,Iend,nev,maxit,its,nconv; </div><div> PetscErrorCode ierr; </div><div> ierr = SlepcInitialize(&argc,&argv,(char*)0,help);CHKERRQ(ierr); </div><div> ierr = PetscOptionsGetInt(NULL,NULL,"-n",&n,NULL);CHKERRQ(ierr);</div><div> ierr = PetscPrintf(PETSC_COMM_WORLD,"\n1-D Laplacian Eigenproblem, n=%D\n\n",n);CHKERRQ(ierr); </div><div><br></div><div>I am wondering if the memory is lost by calling CHKERRQ.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 20, 2020 at 10:14 AM Dave May <<a href="mailto:dave.mayhem23@gmail.com">dave.mayhem23@gmail.com</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"><div><br></div><div><br><div class="gmail_quote"><div dir="ltr">On Mon 20. Jan 2020 at 19:11, Sam Guo <<a href="mailto:sam.guo@cd-adapco.com" target="_blank">sam.guo@cd-adapco.com</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"><div dir="ltr">Dear PETSc dev team,<div> If PETSc function returns an error, what's the correct way to clean PETSc? </div></div></blockquote><div dir="auto"><br></div><div dir="auto">The answer depends on the error message reported. Send the complete error message and a better answer can be provided.</div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Particularly how to clean up the memory?</div></div></blockquote><div dir="auto"><br></div><div dir="auto">Totally depends on the objects which aren’t being freed. You need to provide more information</div><div dir="auto"><br></div><div dir="auto">Thanks</div><div dir="auto">Dave</div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div><br></div><div>Thanks,</div><div>Sam</div></div>
</blockquote></div></div>
</blockquote></div>