From 5ffe29cb9f260f35f1ae0f878885a77d42a29d8b Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 13 Mar 2015 20:57:33 +0100 Subject: [PATCH] Bound pre-allocation to the maximal size representable by StorageIndex and throw bad_alloc if that's not possible. --- Eigen/src/SparseCore/CompressedStorage.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Eigen/src/SparseCore/CompressedStorage.h b/Eigen/src/SparseCore/CompressedStorage.h index 49fd46658..52c7da297 100644 --- a/Eigen/src/SparseCore/CompressedStorage.h +++ b/Eigen/src/SparseCore/CompressedStorage.h @@ -86,7 +86,12 @@ class CompressedStorage void resize(Index size, double reserveSizeFactor = 0) { if (m_allocatedSize)(NumTraits::highest(), size + Index(reserveSizeFactor*double(size))); + if(realloc_size