You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The matrices have to be large enough to use dynamically allocated memory.
And this bug has shown up for me on Windows with Clang 11/12 and MSVC, as well as WSL Ubuntu using GCC.
The text was updated successfully, but these errors were encountered:
@kjohnsen thanks for reporting. I could reproduce and it's a bug.
Fixed in 8adfd96.
However, you are not copying when doing this! What is happening is that the mh1 borrows the memory of the matrix of mh2. Remember, we avoid copying as much as possible so the type-cast, which you implicitly use, borrows by default.
What you are doing with mh1.A = mh2.A:
convert the arma::mat A from mh2 to a Numpy array
pass that Numpy array to the setter for mh1
convert the Numpy array, by borrowing, to the arma::mat B in the setter
Now both mh1.A and mh2.A are aliasing the same memory!
For the bug, as the Numpy array will not own the data it would, wrongly, trigger the swap-copy conversion which should not allow not-owndata arrays.
I'll create a patch release later this week but for now you can use the unstable branch.
Believe it or not, I actually ran into another, separate heap corruption error when copy-assigning one matrix to another, e.g.,
mre.cpp
:pymod_test.py
:The matrices have to be large enough to use dynamically allocated memory.
And this bug has shown up for me on Windows with Clang 11/12 and MSVC, as well as WSL Ubuntu using GCC.
The text was updated successfully, but these errors were encountered: