Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] BUG in Filtered_bbox_circular_kernel_2

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] BUG in Filtered_bbox_circular_kernel_2


Chronological Thread 
  • From: Wolfgang Aigner <>
  • To:
  • Subject: Re: [cgal-discuss] BUG in Filtered_bbox_circular_kernel_2
  • Date: Thu, 10 Apr 2008 17:14:36 +0200
  • Organization: IST TU Graz

On Thursday 10 April 2008 16:48:33 Wolfgang Aigner wrote:
> When using the Filtered_bbox_circular_kernel_2 and checking the results
> with valgrind, I experienced some huuuuuge memory leaks resulting from (i
> guess) the bounding box assignment. I wrote some small example for this
> issue:
>
>
> //=====================================================================
>
> #include <CGAL/Cartesian.h>
> #include <CGAL/Algebraic_kernel_for_circles_2_2.h>
> #include <CGAL/Circular_kernel_2.h>
> #include <CGAL/Filtered_bbox_circular_kernel_2.h>
> #include <CGAL/Real_embeddable_traits.h>
> #include <CGAL/Arr_circular_line_arc_traits.h>
>
> #include <CGAL/Conic_2.h>
>
> typedef double dbl;
> typedef CGAL::Cartesian<dbl> LK;
> typedef CGAL::Algebraic_kernel_for_circles_2_2<dbl> AK;
> typedef CGAL::Circular_kernel_2<LK,AK> K_;
> //when replaceing this filtered kernel with circular kernel, no leak
> happens typedef CGAL::Filtered_bbox_circular_kernel_2<K_> K;
>
> typedef K::Line_2 Line;
> typedef K::Point_2 Pnt;
> typedef K::Circular_arc_point_2 Point;
> typedef K::Circle_2 Disk;
> typedef K::Circular_arc_2 Circular_arc;
>
> typedef std::back_insert_iterator<std::vector<CGAL::Object> > OutputIter;
>
> // intersection for line and circle, just to get two points on a disk
> OutputIter Intersect(const Line &l, const Disk &d, OutputIter res)
> {
> K::Polynomial_1_2 e1 = CGAL::get_equation<K>(l);
> K::Polynomial_for_circles_2_2 e2 = CGAL::get_equation<K>(d);
>
> typedef std::vector< std::pair < K::Root_for_circles_2_2, unsigned > >
> solutions_container;
> solutions_container solutions;
>
> K::Algebraic_kernel().solve_object()(e1, e2,
> std::back_inserter(solutions));
>
> for ( solutions_container::iterator it = solutions.begin(); it !=
> solutions.end(); ++it )
> {
> *res++ = make_object(std::make_pair(Point(it->first),
> it->second ));
> }
>
> return res;
> }
>
>
> int main(int argc, char *argv[])
> {
> Line l(Pnt(1.12,3.08), Pnt(7.61,7.49));
> Disk d(Pnt(5,4.6), 11.11, CGAL::CLOCKWISE);
> Disk d2(Pnt(7.61,4.6), 10.2, CGAL::CLOCKWISE);
>
> std::vector<CGAL::Object> result_;
> Intersect(l, d, std::back_inserter(result_));
> std::pair<Point,unsigned> p1_, p2_;
>
> CGAL::assign(p1_, result_[0]);
> CGAL::assign(p2_, result_[1]);
> result_.clear();
>
> Circular_arc arc(d, p1_.first, p2_.first);
>
> // here the memory leak happens when using filtered kernel
> K().intersect_2_object()(d2, arc, std::back_inserter(result_));
>
> return(1);
> }
>
>
> //=====================================================================
>
>
> When valgrinding this with "valgrind --leak-check=full", I lost two blocks
> with 32 bytes each "definitely".
> If I replace the Filtered_bbox_circular_kernel with the normal
> Circular_kernel, then the leak disappears.
>
> I need the memory :) any suggestions?
>
> lg, Wolfgang

sorry, forgot additional information:
platform: ubuntu gutsy 2.6.22
compiler: gcc 4.1.3
CGAL version: 3.3.1




Archive powered by MHonArc 2.6.16.

Top of Page