Mercurial > octave
changeset 31823:f14aea577cc5
Eliminate intermediates created while saving (bug #63803)
ov-bool-mat.cc: Creation of intermediates during saving was tripling
the memory usage and causing OOM crashes in the middle of saving,
causing data loss. This change eliminates the creation of intermediate
copies for one function.
author | Arun Giridhar <arungiridhar@gmail.com> |
---|---|
date | Tue, 14 Feb 2023 14:39:23 -0500 |
parents | 3e4e74ad8fd7 |
children | da5b50dc82b0 8078a7f4edfa |
files | libinterp/octave-value/ov-bool-mat.cc |
diffstat | 1 files changed, 2 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-bool-mat.cc Mon Feb 13 11:10:00 2023 -0800 +++ b/libinterp/octave-value/ov-bool-mat.cc Tue Feb 14 14:39:23 2023 -0500 @@ -362,14 +362,9 @@ } boolNDArray m = bool_array_value (); - bool *mtmp = m.fortran_vec (); + const bool *mtmp = m.data (); octave_idx_type nel = m.numel (); - OCTAVE_LOCAL_BUFFER (char, htmp, nel); - - for (octave_idx_type i = 0; i < nel; i++) - htmp[i] = (mtmp[i] ? 1 : 0); - - os.write (htmp, nel); + os.write (reinterpret_cast<const char*> (mtmp), nel); return true; }