New user self-registration is disabled due to spam. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Before reporting a bug, please make sure that your Eigen version is up-to-date!
Bug 166 - Request to add a private allocator to Eigen
Summary: Request to add a private allocator to Eigen
Status: DECISIONNEEDED
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
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 3.x
  Show dependency treegraph
 
Reported: 2011-01-30 03:37 UTC by Markus Siegert
Modified: 2018-10-09 19:53 UTC (History)
3 users (show)



Attachments

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 https://bitbucket.org/MarkusS/eigen-private-alloc. 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).

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

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...

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