[eigen] portable reallocation...

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi guys,

Since somebody asked on the forum I looked into implementing
..conservativeResize(...) based on realloc where that makes sense. Such
an implementation might yield higher performance since in some cases
the data does not need to be copied.

The issue I am running into right now is that there is no portable
version of _mm_realloc. On MSVC this is not really a problem since
_mm_malloc = _aligned_alloc and thus I can fall back to
_aligned_realloc. On other systems on the other hand side, I have no
idea how _mm_malloc is implemented. An alternative would be to provide
something as shown here

http://stackoverflow.com/questions/1641067/i-figured-out-how-to-write-realloc-but-i-know-the-code-is-not-right

Also not very nice and still no solution since the standard does not
define a function mm_getsize. On MSVC it is called _msize and on other
systems it has different names - when it exists at all.

The gist is that without knowing the size of the memory buffer I am
about to reallocate, there is no way in implementing a malloc/free
based version of realloc.

Any suggestions?

- Hauke



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/