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: "Pedro Machado Manhães de Castro" <>
  • To:
  • Subject: Re: [cgal-discuss] BUG in Filtered_bbox_circular_kernel_2
  • Date: Fri, 11 Apr 2008 13:32:29 +0200
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=DtZimajEGZ8RF/uR1q7hPBypAzyr0C9r8UcjYdTIdt+gjodFkWGJ5F5/ouMWFtX4YxY6gOVLG7wV80GNIz9Eb/EHAS1UVOKbGj1BtEOCDuK0zDIPPXCpc/n6tmgtKNvP44+wXUpPzlIFAmWMERMF5IZVDK4lrkaWzQMsf7YV3/U=

Hi Wolfgang Aigner,

Thanks to report that. However I could not reproduce it here with g++ 4.1.1 and CGAL 3.3.1. When I run with valgrind I get:

valgrind --leak-check=full test (test is your program)
==3974== Memcheck, a memory error detector.
==3974== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==3974== Using LibVEX rev 1732, a library for dynamic binary translation.
==3974== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==3974== Using valgrind-3.2.3, a dynamic binary instrumentation framework.
==3974== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==3974== For more details, rerun with: -v
==3974==
==3974==
==3974== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 12 from 1)
==3974== malloc/free: in use at exit: 0 bytes in 0 blocks.
==3974== malloc/free: 30 allocs, 30 frees, 1,981 bytes allocated.
==3974== For counts of detected errors, rerun with: -v
==3974== All heap blocks were freed -- no leaks are possible.

Could you please give me more details, like the messages valgrind gaves you? I dont think that the compiler is an issue, but I will try later with exactly your specifications (it means with compiler 4.1.3 and maybe with your version of linux).

Best Regards,
Pedro

On Thu, Apr 10, 2008 at 5:14 PM, Wolfgang Aigner <> wrote:
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

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss




Archive powered by MHonArc 2.6.16.

Top of Page