Subject: CGAL users discussion list
List archive
- From: Wolfgang Aigner <>
- To:
- Subject: Re: [cgal-discuss] BUG in Filtered_bbox_circular_kernel_2
- Date: Fri, 11 Apr 2008 16:08:24 +0200
- Organization: IST TU Graz
Rehi Pedro,
Here my valgrind output from "valgrind --tool=memcheck --leak-check=full"
==8760== Memcheck, a memory error detector.
==8760== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==8760== Using LibVEX rev 1732, a library for dynamic binary translation.
==8760== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==8760== Using valgrind-3.2.3-Debian, a dynamic binary instrumentation
framework.
==8760== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==8760== For more details, rerun with: -v
==8760==
==8760==
==8760== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 85 from 1)
==8760== malloc/free: in use at exit: 54,662 bytes in 11 blocks.
==8760== malloc/free: 492 allocs, 481 frees, 75,624 bytes allocated.
==8760== For counts of detected errors, rerun with: -v
==8760== searching for pointers to 11 not-freed blocks.
==8760== checked 782,140 bytes.
==8760==
==8760== 32 bytes in 1 blocks are definitely lost in loss record 7 of 11
==8760== at 0x4022F0C: operator new(unsigned) (vg_replace_malloc.c:163)
==8760== by 0x805225C: std::back_insert_iterator<std::vector<CGAL::Object,
std::allocator<CGAL::Object> > >
CGAL::Bbox_functors::Intersect_2<CGAL::Filtered_bbox_circular_kernel_2<CGAL::Circular_kernel_2<CGAL::Cartesian<double>,
CGAL::Algebraic_kernel_for_circles_2_2<double> > >
>::operator()<std::back_insert_iterator<std::vector<CGAL::Object,
std::allocator<CGAL::Object> > >
>(CGAL::Circular_arc_with_bbox_2<CGAL::Filtered_bbox_circular_kernel_2<CGAL::Circular_kernel_2<CGAL::Cartesian<double>,
>
CGAL::Algebraic_kernel_for_circles_2_2<double> > > > const&,
CGAL::Circular_arc_with_bbox_2<CGAL::Filtered_bbox_circular_kernel_2<CGAL::Circular_kernel_2<CGAL::Cartesian<double>,
CGAL::Algebraic_kernel_for_circles_2_2<double> > > > const,
std::back_insert_iterator<std::vector<CGAL::Object,
std::allocator<CGAL::Object> > >) (Circular_arc_with_bbox_2.h:157)
==8760== by 0x8049C84: main (check_leak.cpp:71)
==8760==
==8760==
==8760== 32 bytes in 1 blocks are definitely lost in loss record 8 of 11
==8760== at 0x4022F0C: operator new(unsigned) (vg_replace_malloc.c:163)
==8760== by 0x80521FC: std::back_insert_iterator<std::vector<CGAL::Object,
std::allocator<CGAL::Object> > >
CGAL::Bbox_functors::Intersect_2<CGAL::Filtered_bbox_circular_kernel_2<CGAL::Circular_kernel_2<CGAL::Cartesian<double>,
CGAL::Algebraic_kernel_for_circles_2_2<double> > >
>::operator()<std::back_insert_iterator<std::vector<CGAL::Object,
std::allocator<CGAL::Object> > >
>(CGAL::Circular_arc_with_bbox_2<CGAL::Filtered_bbox_circular_kernel_2<CGAL::Circular_kernel_2<CGAL::Cartesian<double>,
>
CGAL::Algebraic_kernel_for_circles_2_2<double> > > > const&,
CGAL::Circular_arc_with_bbox_2<CGAL::Filtered_bbox_circular_kernel_2<CGAL::Circular_kernel_2<CGAL::Cartesian<double>,
CGAL::Algebraic_kernel_for_circles_2_2<double> > > > const,
std::back_insert_iterator<std::vector<CGAL::Object,
std::allocator<CGAL::Object> > >) (Circular_arc_with_bbox_2.h:157)
==8760== by 0x8049C84: main (check_leak.cpp:71)
==8760==
==8760== LEAK SUMMARY:
==8760== definitely lost: 64 bytes in 2 blocks.
==8760== possibly lost: 0 bytes in 0 blocks.
==8760== still reachable: 54,598 bytes in 9 blocks.
==8760== suppressed: 0 bytes in 0 blocks.
==8760== Reachable blocks (those to which a pointer was found) are not shown.
==8760== To see them, rerun with: --leak-check=full --show-reachable=yes
Profiling timer expired
The program has been compiled on ubuntu, but the growing memory issue also
happened in my original program (not the minimal example i sent), when
running a statically compiled version on debian
lg, Wolfgang
On Friday 11 April 2008 13:32:29 Pedro Machado Manhães de Castro wrote:
> 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
- BUG in Filtered_bbox_circular_kernel_2, Wolfgang Aigner, 04/10/2008
- Re: [cgal-discuss] BUG in Filtered_bbox_circular_kernel_2, Wolfgang Aigner, 04/10/2008
- Re: [cgal-discuss] BUG in Filtered_bbox_circular_kernel_2, Pedro Machado Manhães de Castro, 04/11/2008
- Re: [cgal-discuss] BUG in Filtered_bbox_circular_kernel_2, Wolfgang Aigner, 04/11/2008
- Re: [cgal-discuss] BUG in Filtered_bbox_circular_kernel_2, Pedro Machado Manhães de Castro, 04/11/2008
- Re: [cgal-discuss] BUG in Filtered_bbox_circular_kernel_2, Andreas Fabri, 04/17/2008
- Re: [cgal-discuss] BUG in Filtered_bbox_circular_kernel_2, Wolfgang Aigner, 04/18/2008
- Re: [cgal-discuss] BUG in Filtered_bbox_circular_kernel_2, Andreas Fabri, 04/18/2008
- Re: [cgal-discuss] BUG in Filtered_bbox_circular_kernel_2, Wolfgang Aigner, 04/18/2008
- Re: [cgal-discuss] BUG in Filtered_bbox_circular_kernel_2, Andreas Fabri, 04/18/2008
- Re: [cgal-discuss] BUG in Filtered_bbox_circular_kernel_2, Wolfgang Aigner, 04/18/2008
- Re: [cgal-discuss] BUG in Filtered_bbox_circular_kernel_2, Andreas Fabri, 04/18/2008
- Re: [cgal-discuss] BUG in Filtered_bbox_circular_kernel_2, Wolfgang Aigner, 04/18/2008
- Re: [cgal-discuss] BUG in Filtered_bbox_circular_kernel_2, Wolfgang Aigner, 04/10/2008
Archive powered by MHonArc 2.6.16.