(this might have been reported already or it might be a "feature" but just in case I prefer to open a ticket)
The SparseMatrix class (defined in SparseCore/SparseMatrix.h) does not enforce the EIGEN_NO_MALLOC macro; "std::malloc" and "std::free" are directly called at various locations in the code (as far as I can tell it seems to always be related to resizing operations on the inner and outer indices storage).
I am not sure this is to be considered as a bug but it is somewhat troublesome that in spite of defining the EIGEN_NO_MALLOC macro there are still malloc calls behind the scene.
It seems the fix would be easy to implement by using the functions defined in Memory.h; I can provide a quick draft if needed.
In the sparse world, almost any operations will perform dynamic allocation, so I don't see much use case to extend this debugging mechanism to sparse matrices. Recall that EIGEN_NO_MALLOC does not change the behavior of Eigen: it only helps in debugging code.
I don't see anything wrong with having EIGEN_NO_MALLOC also affect sparse operations.
There are several operations which do not alloc, e.g., matrix*vector products or inserting values into a properly pre-allocated matrix.
Maybe a small nitpicking thing against it is that sparse matrices use new/delete instead of (aligned_)malloc/(aligned_)free (so the naming of the macro does not fit).
-- GitLab Migration Automatic Message --
This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1185.