This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 1185 - SparseMatrix class does not enforce the EIGEN_NO_MALLOC macro
Summary: SparseMatrix class does not enforce the EIGEN_NO_MALLOC macro
Status: DECISIONNEEDED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Sparse (show other bugs)
Version: 3.2
Hardware: All All
: Normal Internal Design
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-29 19:23 UTC by velin
Modified: 2019-12-04 15:34 UTC (History)
3 users (show)



Attachments

Description velin 2016-03-29 19:23:06 UTC
(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.
Comment 1 Gael Guennebaud 2016-04-05 11:28:02 UTC
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.
Comment 2 Christoph Hertzberg 2016-04-05 11:52:03 UTC
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).
Comment 3 Nobody 2019-12-04 15:34:42 UTC
-- 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.

Note You need to log in before you can comment on or make changes to this bug.