Benoit does not seem to be proposing
"overriding malloc". Rather he admits the possibility than
someone may have already done so, even on MacOS.
On 12/13/2014 08:49 AM, Kaelin Colclasure wrote:
Overriding Malloc on Mac OS X systems is an especially bad
idea. Apple has spent a lot of engineering time and effort
working with internal teams to integrate the Malloc
implementation deeply into the many various frameworks, and then
building performance tools that rely on features of the system
Malloc.
I acknowledge that Eigen is not just a typical code library,
and on some platforms the libc Malloc might not accommodate
vector alignment requirements. But Mac OS X is not one of those
platforms, and thus a library that blindly overrides Malloc is
causing wholly unnecessary breakage of numerous system features.
I have admittedly not reviewed either Eigen's existing code
paths or the proposed changes, but I wanted to offer a different
perspective on the trade-offs inherent in substituting Malloc
implementations on different platforms.
Sent from my iPad
Motivation
for these changes, aside from removing code:
The
"malloc is already aligned" path relies on the assumption that
malloc's nonstandard properties are only a function of the
platform, which we tried to detect using preprocessor tokens.
But malloc is not a system feature, it's a C library feature
and many applications override it. Thus, we can't know if
malloc is already aligned based on platform checks.