diff --git a/Solver/linearSystemPETSc.hpp b/Solver/linearSystemPETSc.hpp index 9fe2ae310fc10f5ac61cb5ee6c8f18c418e75aa7..75656d52f34f9881d3255852e07af963d97f4daa 100644 --- a/Solver/linearSystemPETSc.hpp +++ b/Solver/linearSystemPETSc.hpp @@ -93,7 +93,7 @@ void linearSystemPETSc<scalar>::preAllocateEntries() int blockSize = _getBlockSizeFromParameters(); std::vector<int> nByRowDiag (_localSize), nByRowOffDiag (_localSize); if (_sparsity.getNbRows() == 0) { - PetscInt prealloc = 300; + PetscInt prealloc = std::min(300,_localSize); PetscBool set; PetscOptionsGetInt(PETSC_NULL, "-petsc_prealloc", &prealloc, &set); nByRowDiag.resize(0);