[eigen] Re: Custom new[]/delete[]

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




On Thu, Jan 8, 2015 at 1:15 PM, Pavel Holoborodko <pavel@xxxxxxxxxxxxxxx> wrote:
I see that *_auto allocators are used for dense matrices (DenseStorage.h):

conditional_aligned_new_auto
conditional_aligned_realloc_new_auto
conditional_aligned_delete_auto

align_new, align_delete are used in GeneralMatrixMatrix.h

Looks like only these functions should be overloaded. 

You might also want to overload aligned_malloc/aligned_free which are used by ei_declare_aligned_stack_constructed_variable. Those functions perform only the memory allocation part, not the construction of the objects.

Looking at all these variants, it seems that align_new/align_delete could be removed and replaced in favor of the _auto variants. Likewise, the "conditional_aligned_" non "auto" variants could be removed as they are not used at all.

gael
 

Please confirm.

Thank you in advance,
Pavel.

P.S.
SparseMatrix uses pure overloadable new[]/delete[] - no questions there.


On Thu, Jan 8, 2015 at 8:44 PM, Pavel Holoborodko <pavel@xxxxxxxxxxxxxxx> wrote:
How can I make Eigen use my own delete[]/new[] defined for custom scalar type?
Now Eigen uses its own allocators. 

Please confirm what functions should be specialized:

template<typename T> inline T* aligned_new(size_t size)
template<typename T> inline void aligned_delete(T *ptr, size_t size)

template<typename T, bool Align> inline T* conditional_aligned_new(size_t size)
template<typename T, bool Align> inline void conditional_aligned_delete(T *ptr, size_t size)
template<typename T, bool Align> inline T* conditional_aligned_realloc_new(T* pts, size_t new_size, size_t old_size)

Is it enough, or *_auto, *_stack and others should be taken care of too?




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