octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #61813] memory management bug when calling MEX


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #61813] memory management bug when calling MEX that returns an output
Date: Sun, 20 Feb 2022 22:49:44 -0500 (EST)

Update of bug #61813 (project octave):

                  Status:                    None => Patch Submitted        

    _______________________________________________________

Follow-up Comment #9:

The attached change fixes the problem for me.  It reverts to always copy
unless we are using the polymorphic allocator and avoids allowing Octave to
delete data transferred from an mxArray to an octave_value object unless it is
done when returning from a MEX function call.

The problem was that in handing off ownership of the data in an mxArray object
with a single element to an octave_value object, the octave_value object may
mutate from an array to a scalar object and then the mxArray data would be
deleted.  That obviously causes trouble if the mxArray data is needed again
after it is used by by Octave in the octave_value object as was the case in
the example (the rhs data used after calling mexCallMATLAB).

I'll create a proper (set of) changeset(s) soon and commit on stable.




(file #52896)
    _______________________________________________________

Additional Item Attachment:

File name: mx-2-ov-alloc-diffs.txt        Size:7 KB
    <https://file.savannah.gnu.org/file/mx-2-ov-alloc-diffs.txt?file_id=52896>



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?61813>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]