Fix #29048: iTaSC solver crash on certain compilers/platforms, due to memory
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 13 Nov 2011 12:25:14 +0000 (12:25 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 13 Nov 2011 12:25:14 +0000 (12:25 +0000)
alignment issues with Eigen. Patch by Tobias Oelgarte.

intern/itasc/kdl/chain.hpp
intern/itasc/kdl/tree.hpp

index 0d40690202a34ddebb757544c257e2cc6ff2aace..a2b4905622e2f1e1d74c6d4928285be582b6ad40 100644 (file)
@@ -34,7 +34,8 @@ namespace KDL {
      */
     class Chain {
     private:
-        std::vector<Segment> segments;
+        // Eigen allocator is needed for alignment of Eigen data types
+        std::vector<Segment, Eigen::aligned_allocator<Segment> > segments;
         unsigned int nrOfJoints;
         unsigned int nrOfSegments;
     public:
index bdd3aa9457280da6569520cf14a2b3d2f555ed85..6b822dcd1e06e1405097d20419fcce6aed5e1daa 100644 (file)
 
 #include <string>
 #include <map>
+#include <Eigen/Core>
 
 namespace KDL
 {
     //Forward declaration
     class TreeElement;
-    typedef std::map<std::string,TreeElement> SegmentMap;
+    // Eigen allocator is needed for alignment of Eigen data types
+    typedef std::map<std::string,TreeElement, std::less<std::string>, Eigen::aligned_allocator<std::pair<std::string, TreeElement> > > SegmentMap;
 
     class TreeElement
     {