← Back to team overview

yade-dev team mailing list archive

[Bug 1380103] Re: memory leak?

 

Dear Sway,

I am the "developer" of the polyhedral code. The problem you are
experiencing is related to CGAL. When two particles come into the
contact, there is an algorithm that computes the volume of the
intersection. The volume is computed based on two runs of CGAL method
Convex_Hull (you can find it in paper Simulation of railway ballast
using crushable polyhedral particles. Powder Technology, 246, pp.
458-465). However, that method may result in error as occured to you due
to inconvenient input point (like points almost in plane). It would be
nice if CGAL just return warning and one can handle it then, but instead
it results in termination of the process.

In the YADE polyhedral code, there are few check points that try to
identify the wrong input and handle it as no contact. But they are based
on some chosen level, at which the points are rejected. You can set
those values differently to be more strict in rejection of the inputs,
but as a result you will get problems with stability (your contacts will
imediatelly jump from no penetration to high penetration depth). As you
now realize, these problems are typical for materials with high
stiffness. I used 2x10^13 for gravel, I had these problems only few
times. But for higher stiffness (you use 10^16, what material do you
simulate), it will become more and more frequent.

Well, I do not have much help for you. You can try to decrease stiffness
of your material (I tried on your code and it works just fine). Or you
can play with controlling levels (in PolyhedraSupport.cpp), they are
currently set to:

//DISTANCE_LIMIT controls numerical issues in calculating intersection. It should be small enough to neglect only extremely small overlaps, but large enough to prevent errors during computation of convex hull
#define DISTANCE_LIMIT 2E-11	//-11
//MERGE_PLANES_LIMIT - if two facets of two intersecting polyhedron differ less, then they are treated ose one only
#define MERGE_PLANES_LIMIT 1E-18 //18
//SIMPLIFY_LIMIT - if two facets of one polyhedron differ less, then they are joint into one facet
#define SIMPLIFY_LIMIT 1E-19 //19
//FIND_NORMAL_LIMIT - to determine which facet of intersection belongs to which polyhedron
#define FIND_NORMAL_LIMIT 1E-40

Best regards, Jan Elias

-- 
You received this bug notification because you are a member of Yade
developers, which is subscribed to Yade.
https://bugs.launchpad.net/bugs/1380103

Title:
  memory leak?

Status in Yet Another Dynamic Engine:
  New

Bug description:
  YADE version:1.11.1
  I simulated a packing with Polyhedra shape recently. When running about 50,000 (not constant ) steps, a bug occurred casting information as follow:
      Error in `/usr/bin/python': malloc(): memory corruption (fast): 0x00007fc6780762d8
  So give me some hints to find the reason, please.

  gdb:

  Program received signal SIGABRT, Aborted.
  [Switching to Thread 0x7f3257fff700 (LWP 3066)]
  0x00007f32b7760bb9 in __GI_raise (sig=sig@entry=6)
      at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
  56	../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
  (gdb) bt
  #0  0x00007f32b7760bb9 in __GI_raise (sig=sig@entry=6)
      at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
  #1  0x00007f32b7763fc8 in __GI_abort () at abort.c:89
  #2  0x00007f32b779de14 in __libc_message (do_abort=do_abort@entry=1,
      fmt=fmt@entry=0x7f32b78ac668 "*** Error in `%s': %s: 0x%s ***\n")
      at ../sysdeps/posix/libc_fatal.c:175
  #3  0x00007f32b77a8b77 in malloc_printerr (action=<optimized out>,
      str=0x7f32b78aca08 "malloc(): memory corruption (fast)",
      ptr=<optimized out>) at malloc.c:4996
  #4  0x00007f32b77ab884 in _int_malloc (av=0x7f3250000020, bytes=48)
      at malloc.c:3359
  #5  0x00007f32b77ad230 in __GI___libc_malloc (bytes=48) at malloc.c:2891
  #6  0x00007f32b1639f2d in operator new(unsigned long) ()
     from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
  #7  0x00007f32b441cb23 in void CGAL::In_place_list<CGAL::HalfedgeDS_in_place_list_vertex<CGAL::I_Polyhedron_vertex<CGAL::HalfedgeDS_vertex_base<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Point_3<CGAL::Epick> > > >, false, std::allocator<CGAL::HalfedgeDS_in_place_list_vertex<CGAL::I_Polyhedron_vertex<CGAL::HalfedgeDS_vertex_base<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Point_3<CGAL::Epick> > > > > >::insert<CGAL::internal::In_place_list_const_iterator<CGAL::HalfedgeDS_in_place_list_vert---Type <return> to continue, or q <return> to quit---
  ex<CGAL::I_Polyhedron_vertex<CGAL::HalfedgeDS_vertex_base<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Point_3<CGAL::Epick> > > >, std::allocator<CGAL::HalfedgeDS_in_place_list_vertex<CGAL::I_Polyhedron_vertex<CGAL::HalfedgeDS_vertex_base<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Point_3<CGAL::Epick> > > > > > >(CGAL::internal::In_place_list_iterator<CGAL::HalfedgeDS_in_place_list_vertex<CGAL::I_Polyhedron_vertex<CGAL::HalfedgeDS_vertex_base<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Point_3<CGAL::Epick> > > >, std::allocator<CGAL::HalfedgeDS_in_place_list_vertex<CGAL::I_Polyhedron_vertex<CGAL::HalfedgeDS_vertex_base<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Point_3<CGAL::Epick> > > > > >, CGAL::internal::In_place_list_const_iterator<CGAL::HalfedgeDS_in_place_list_vertex<CGAL::I_Polyhedron_vertex<CGAL::HalfedgeDS_vertex_base<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Point_3<CGAL::Epick> > > >, std::allocator<CGAL::HalfedgeDS_in_place_list_vertex<CGAL::I_Polyhedron_vertex<CGAL::HalfedgeDS_vertex_base<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Point_3<CGAL::Epick> > > > > >, CGAL::internal::In_place_list_const_iterator<CGAL::HalfedgeDS_in_---Type <return> to continue, or q <return> to quit---
  place_list_vertex<CGAL::I_Polyhedron_vertex<CGAL::HalfedgeDS_vertex_base<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Point_3<CGAL::Epick> > > >, std::allocator<CGAL::HalfedgeDS_in_place_list_vertex<CGAL::I_Polyhedron_vertex<CGAL::HalfedgeDS_vertex_base<CGAL::HalfedgeDS_list_types<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >, CGAL::Boolean_tag<true>, CGAL::Point_3<CGAL::Epick> > > > > >) ()
     from .../temp-install/lib/x86_64-linux-gnu/yade-1.11.1/libyade.so
  #8  0x00007f32b442abc4 in CGAL::HalfedgeDS_list<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> >::HalfedgeDS_list(CGAL::HalfedgeDS_list<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::allocator<int> > const&) ()
     from .../temp-install/lib/x86_64-linux-gnu/yade-1.11.1/libyade.so
  #9  0x00007f32b49118e2 in Simplify(CGAL::Polyhedron_3<CGAL::Epick, CGAL::Polyhedron_items_3, CGAL::HalfedgeDS_default, std::allocator<int> >, double) ()
     from .../temp-install/lib/x86_64-linux-gnu/yade-1.11.1/libyade.so
  #10 0x00007f32b4915e21 in Polyhedron_Plane_intersection(CGAL::Polyhedron_3<CGAL::Epick, CGAL::Polyhedron_items_3, CGAL::HalfedgeDS_default, std::allocator<int> >, CGAL::Plane_3<CGAL::Epick>, CGAL::Point_3<CGAL::Epick>, CGAL::Point_3<CGAL::Epick>) ()
     from .../temp-install/lib/x86_64-linux-gnu/yade-1.11.1/libyade.so
  #11 0x00007f32b48ea0f8 in Ig2_Wall_Polyhedra_PolyhedraGeom::go(boost::shared_ptr<Shape> const&, boost::shared_ptr<Shape> const&, State const&, State const&, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&, bool const&, boost::shared_ptr<Interaction> const&) ()

  Something wrong in function "Simplify" within Polyhedra_support.cpp:

  Polyhedron Simplify(Polyhedron P, double limit){
   bool elimination = true;
   while(elimination){
    elimination = false;
    for (Polyhedron::Edge_iterator hei = P.edges_begin(); hei!=P.edges_end(); ++hei){
     if (PlaneDifference(hei->facet()->plane(),hei->opposite()->facet()->plane()) < limit){
      if (hei->vertex()->vertex_degree() < 3) hei = P.erase_center_vertex(hei);
      else if(hei->opposite()->vertex()->vertex_degree() < 3) hei = P.erase_center_vertex(hei->opposite());
      else hei = P.join_facet(hei);
      elimination = true;
      break;
     }
    }
   }
   if (P.size_of_facets() < 4) P.clear();
   return P;
  }

To manage notifications about this bug go to:
https://bugs.launchpad.net/yade/+bug/1380103/+subscriptions


Follow ups

References