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

[SOLVED] UnalignedArray Assert when adding element to map

Tags: None
(comma "," separated)
stefanTUD
Registered Member
Posts
5
Karma
0
Hi Everyone,
I´ve got the following code which gives me the infamous "Unaligned Array" assert in line 3, when trying to add the transformation to the map.
Code: Select all
  roboapp::Timestamp timestamp = model->getTimestamp();
  Eigen::Transform3f transformation  = model->getTransformation();
  incMap[timestamp] = transformation;


incMap ist just a std:map:
Code: Select all
std::map incMap;


and model´s getTransformation just returns some Eigen::Transformation3f :
Code: Select all
Eigen::Transform3f Model::getTransformation() const
{
  return Eigen::Transform3f(Eigen::Matrix4f::Identity() );
}


So it looks like when inserting the Eigen::Transform3f into the map, Operator new is not used, and thus I get the alignment assert. Is there a workaround for this, or am I misunderstanding something?

regards,
Stefan

Last edited by stefanTUD on Fri Jan 09, 2009 7:30 pm, edited 1 time in total.
User avatar
bjacob
Registered Member
Posts
658
Karma
3
Svn up and retry please :)

Probably std::map calls a placement new and until beta5 included this wasn't getting overloaded for Transform. The latest code uses a unique macro EIGEN_MAKE_ALIGNED_OPERATOR_NEW that overloads the placement new as well. So it should fix your issue.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
stefanTUD
Registered Member
Posts
5
Karma
0
Ok, maybe I should´ve been more specific about my configuration:
I´m using VS2005 and the Eigen2 directly via latest svn.
I still have the problem though :
User avatar
bjacob
Registered Member
Posts
658
Karma
3
quick update from IRC until we finish solving this issue...
the problem is that a custom allocator must be used with this map. ei_new_allocator does that but then it has issues of its own.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
kfriddile
Registered Member
Posts
23
Karma
0
bjacob wrote:quick update from IRC until we finish solving this issue...
the problem is that a custom allocator must be used with this map. ei_new_allocator does that but then it has issues of its own.


I have just committed "aligned_allocator" which should allow you to store aligned types in a std::map. There is still sometimes a compile-time issue with other STL containers that have a standard-conformant resize() method that passes by value, but I believe this should fix the original issue with std::map like so:

std::map, aligned_allocator > matrixMap;


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell