This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Why shouldn't I use "EIGEN_NO_MALLOC" in production code?

Tags: None
(comma "," separated)
quantdev
Registered Member
Posts
17
Karma
0
I am currently writing code which should not be allocating memory dynamically. In order to ensure this is the case, I was thinking of defining the EIGEN_NO_MALLOC preprocessor directive.

However, on your page on preprocessor directives it clearly states;

These macros are mainly meant for people developing Eigen and for testing purposes. Even though, they might be useful for power users and the curious for debugging and testing purpose, they should not be used by real-word code.


Are there any caveats or runtime performance implications of using this macro? Aren't all the asserts static?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
no performance penalty, but what do you prefer in the case a memory allocation occurs why you did not expected it? Do you prefer that your program crash because of the assert, or that your programme still perform the memory allocation?
quantdev
Registered Member
Posts
17
Karma
0
ggael wrote:no performance penalty, but what do you prefer in the case a memory allocation occurs why you did not expected it? Do you prefer that your program crash because of the assert, or that your programme still perform the memory allocation?


Well, the ideal behaviour would be that it fails to compile, but that if it does compile it can never allocate.


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]