[petsc-users] [petsc-dev] MatPreallocatorPreallocate segfault with PETSC 3.16

Jed Brown jed at jedbrown.org
Wed Feb 2 20:09:33 CST 2022

Marius Buerkle <mbuerkle at web.de> writes:

> Thanks for they reply. Yes the example works, this is how I was doing it before. But the matrix is rather big and i need a matrix with the same structure at various points in my code. So it was convenient to create the matrix with preallocate, destroy it after using it to free the memory and creating it again later with the same preallocate.
> Anyway it works with MatDuplicate for now.

I think it should take *less* memory to destroy the preallocator and duplicate the actual matrix than to destroy the matrix and persist the preallocator. If that is not the case (or close enough), we can make it so.

More information about the petsc-users mailing list