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

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

[Octave-bug-tracker] [bug #64687] mxMalloc thread safety and mxCreateNum


From: anonymous
Subject: [Octave-bug-tracker] [bug #64687] mxMalloc thread safety and mxCreateNumericArray performance
Date: Wed, 20 Sep 2023 15:47:07 -0400 (EDT)

Follow-up Comment #3, bug #64687 (project octave):

There's another issue with mxCreateNumericArray in combination with complex.
It seems that it allocates on the basis of a real value rather than a complex
value.
`
mwSize n[2] = {3,3};

mxArray *arr = mxCreateNumericArray(2, n, mxDOUBLE_CLASS, mxCOMPLEX);

std::complex<double> *p = (std::complex<double>*)mxGetData(arr);

for (mwSize k=0; k<n[0]*n[1]; k++) std::cout << p[k];
`
Gives:
(0,0)(0,0)(0,0)(0,0)(0,3.21143e-322)(6.91622e-310,6.91622e-310)(9.51807e-307,1.63042e-322)(6.91622e-310,6.91622e-310)(3.16202e-322,2.56914e-322)

The first 3x3 elements are zero (correct) but the last 9 are uninitialized. I
think actually they are not even allocated because I get core dumps if I
access the array.



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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