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

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

[Octave-bug-tracker] [bug #29475] new incompatibility of MEX function in


From: Xiangmin Jiao
Subject: [Octave-bug-tracker] [bug #29475] new incompatibility of MEX function in Octave 3.2.x
Date: Fri, 09 Apr 2010 05:47:31 +0000
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTB6

Follow-up Comment #2, bug #29475 (project octave):

Thanks for your quick reply. This feature is not documented for end-users,
but it is an undocumented feature that Mathworks and some MEX-function
developers use. Here are a couple of pieces of evidence for it:

MATLAB has two undocumented (but widely used) functions mxIsSharedArray and
mxUnshareArray for MEX functions. Because MATLAB is "copy on write", there
functions are used to unshare an input mxArray argument before a C-MEX
function modifies it. For example, MPITB uses it (for performance reasons). If
you search the MEX binaries that come with MATLAB, some Mathworks' own
functions also use them. There are also discussions about these on MATLAB
Central. For example, the thread 
http://www.mathworks.com/matlabcentral/newsreader/view_thread/163743

Note that I am not requesting adding the above two functions in Octave,
because a MEX developer can ensure the array is unshared in the caller by
using the property of "copy on write", and thankfully it works for both MATLAB
and Octave. (I use it in mexCGNS for MATLAB and Octave
http://code.google.com/p/mexcgns/).

However, there are a few compelling reasons to change the behavior of passing
character string back to how it was in 3.0.x:

1. If Octave sticks to "copy on write" as in MATLAB, then there is no reason
to make a copy of the character string in mxArray before passing to
mexFunction (unless Octave has to make a copy for some reason).

2. It would make the code more efficient both in terms of memory and speed,
and both within Octave and in user' mex function.

3. It delivers better compatibility between Octave and MATLAB, and would not
break some mex functions that used to work with Octave 3.0.x (like mexCGNS).


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?29475>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

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