I kept getting processes killed as out-of-memory for the "MATRIX - very
large matrices" test. Somehow, GSL was really trying to allocate a
matrix with 230,000,000,000 elements, which would require 1.84 PB of
memory, which I don't have.
This makes the matrix allocator report out-of-memory if a sequence would
have more than about 2 billion elements, fixing my OOM killer problem.
long int n = (end >= start && by > 0 ? (end - start + by) / by
: end <= start && by < 0 ? (start - end - by) / -by
: 0);
- gsl_matrix *m = gsl_matrix_alloc (1, n);
+ gsl_matrix *m = n <= (long) INT32_MAX ? gsl_matrix_alloc (1, n) : NULL;
if (m == NULL)
{
msg_at (SE, matrix_expr_location (e),