This bugzilla service is closed. All entries have been migrated to
Bug 166 - Request to add a private allocator to Eigen
Summary: Request to add a private allocator to Eigen
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - general (show other bugs)
Version: 3.3 (current stable)
Hardware: All All
: Low Feature Request
Assignee: Nobody
Depends on:
Blocks: 3.x
  Show dependency treegraph
Reported: 2011-01-30 03:37 UTC by Markus Siegert
Modified: 2019-12-04 10:14 UTC (History)
3 users (show)


Description Markus Siegert 2011-01-30 03:37:25 UTC
I developed a private allocator greatly reducing the number of malloc's/free's if Eigen is used in a (longer) loop doing the same calculation over and over. To test the code, please pull from my fork at The only Eigen file modified is Memory.h. I added two files PrivateAlloc.h and Mutex.h (both in the same directory src/Core/util) to implement the private allocator 

To use the private allocator, just defined EIGEN_USE_PRIVATE_ALLOC before any eigen include.

You can tune the behavior by adjusting some defines at the beginning the PrivateAlloc.h (like bucket and list sizes).

The code is tested with Mac OSX (10.6.6) and Linux (Ubuntu 10.4 x86).

Comment 1 Gael Guennebaud 2011-01-31 17:58:16 UTC

thank you for the patch, we are currently focusing on releasing 3.0-beta3 and more generally 3.0, so we'll look at this feature later...
Comment 2 Christoph Hertzberg 2014-11-02 17:06:59 UTC
This has been postponed several times. Is there still actual interest in this?
It might actually help to circumvent other problems, like bug 789.

Generally, instead of making this a Yes/No switch between two predefined allocators, I'd rather suggest defining EIGEN_USE_CUSTOM_ALLOC to the name of the allocator which is to be used, and if that is not defined use Eigen::aligned_allocator. Related is bug 779.
Comment 3 Gael Guennebaud 2014-11-04 14:58:28 UTC
One can still globally bypass malloc but a finer control would be welcome.

A related idea would be to use a stack-based allocator for the temporaries created by Eigen itself which requires to somehow change the allocator at runtime, for instance via a template parameter (a la STL), or ctor argument, or...
Comment 4 Nobody 2019-12-04 10:14:18 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to'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:

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