Closed GoogleCodeExporter closed 8 years ago
I believe the STD vector collecton automatically frees the memory after
execution. Is this not correct? Try running valgrind to look for memory leaks,
to which I believe there are none at the moment...
Original comment by mason.gr...@gmail.com
on 14 Dec 2011 at 3:01
EDIT: Google is your friend; stackoverflow.com answers the same exact question.
STD::vector does destruct its elements when it goes out of scope. The problem
here is that your elements are pointers to data type Point, not Point structs
themselves. If you instead did something like this:
vector<A> vec;
vec.push_back(A(1));
vec.push_back(A(2));
...then things would work as you expect.
Original comment by mason.gr...@gmail.com
on 14 Dec 2011 at 3:13
a vector<Point> would indeed free the Point but a vector<Point *> (which is the
CDT constructor argument) will not. It's just that I can't tell whether the
library is meant to free it for you.
I have been freeing my lists when I finish with them and I am not getting any
double-free errors.
Not a big deal, really.
Thanks for your work on this algorithm. It's quite fast :)
Original comment by stevenlu...@gmail.com
on 14 Dec 2011 at 9:31
I added code to the testbed example to free the points. I believe this should
be the user's responsibility, not poly2tri per se.
Thanks for pointing this out; improves the example code.
Original comment by mason.gr...@gmail.com
on 4 Feb 2012 at 9:04
Yup I'm glad you took a look at this a second time. It certainly is the user's
responsibility to free the points, and the testbed is meant to demonstrate what
the user is supposed to do.
Thanks
Original comment by stevenlu...@gmail.com
on 4 Feb 2012 at 9:19
Original issue reported on code.google.com by
stevenlu...@gmail.com
on 14 Dec 2011 at 7:29