New user self-registration is disabled due to spam. Please email eigen-core-team @ if you need an account.
Before reporting a bug, please make sure that your Eigen version is up-to-date!
Bug 729 - EIGEN_ALLOCA is only defined on Linux and Windows with MSVC
Summary: EIGEN_ALLOCA is only defined on Linux and Windows with MSVC
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - general (show other bugs)
Version: 3.2
Hardware: All Other
: High Performance Problem
Assignee: Nobody
Depends on:
Blocks: 3.3
  Show dependency treegraph
Reported: 2014-01-21 14:27 UTC by Christoph Hertzberg
Modified: 2014-06-23 11:22 UTC (History)
2 users (show)


Description Christoph Hertzberg 2014-01-21 14:27:43 UTC
Checking the definition of EIGEN_ALLOCA in src/Core/util/Memory.h it appears that there is a default implementation only for Linux and Windows with MSVC. That excludes at least MacOS and Windows with MinGW/Cygwin (which all support alloca).
Comment 1 Gael Guennebaud 2014-01-21 17:19:06 UTC
Indeed, for safety reason we have been very conservative regarding the use of alloca. In particular, I'm not 100% sure alloca always work with MinGW/Cygwin. I remember we had an issue with mingw, but that was with the 3.4.5 version (!) which is not supported by Eigen anymore.
Comment 2 Christoph Hertzberg 2014-02-17 14:14:48 UTC
Could we produce a compile-time warning (or even an error?) if EIGEN_NO_MALLOC or EIGEN_RUNTIME_NO_MALLOC is defined, but EIGEN_ALLOCA is not?
Maybe with the hint that the user should provide a definition of EIGEN_ALLOCA if he wants to avoid heap allocations.

But we also should determine minimal versions of MacOS, MinGW and Cygwin which already provide alloca.
Comment 3 Christoph Hertzberg 2014-06-20 18:00:13 UTC
Would it be safe enough to add an 
  || (defined alloca)
to the #if condition?
Comment 4 Gael Guennebaud 2014-06-23 09:20:00 UTC
Adding "|| (defined alloca)" seems to be harmless, so go for it.
Comment 5 Christoph Hertzberg 2014-06-23 11:22:25 UTC
Fixed here:

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