|
From: | John W. Eaton |
Subject: | Re: Replace OCTAVE_LOCAL_BUFFER implementation with std::unique_ptr? |
Date: | Wed, 19 Jul 2017 14:24:06 -0400 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
On 07/19/2017 11:25 AM, Rik wrote:
It wasn't that hard so I made two different implementations of OCTAVE_LOCAL_BUFFER. One based on bytes, and one based on the passed in object type T. Unfortunately, while they compile just fine, the resulting binary segfaults. I think what this really means is that there are issues in Octave code around double frees of memory. I've put my work up on the bug report you mentioned.
I also saw a crash on startup with your change. I think you want to use something like
#define OCTAVE_LOCAL_BUFFER(T, buf, size) \ std::unique_ptr<T []> octave_local_buffer_ ## buf { new T [size] }; \ T *buf = octave_local_buffer_ ## buf.get ()for arrays. I posted an updated patch to the bug tracker. Using that patch, I uncovered another memory error that I think is fixed with this changeset:
http://hg.savannah.gnu.org/hgweb/octave/rev/99a9e19bae41 With that, the test suite runs as before. jwe
[Prev in Thread] | Current Thread | [Next in Thread] |