I have pushed some changes now. The plot() family of functions now return boost::shared_ptr<VTKPlotter>. plot.cpp stores a list of shared pointers to the objects (so they will not be destroyed before the program terminates).
(VTKPlotter still maintains a private static list of pointers to all created object to allow interactive() to have effect on all windows, but this is not related to memory handling). Benjamin 2012/8/8 Benjamin Kehlet <benja...@simula.no>: > 2012/8/8 Garth N. Wells <gn...@cam.ac.uk>: >> The lines: >> >> VTKPlotter* plotter = new VTKPlotter(t); >> return plotter; >> >> in the function dolfin::get_plot (dolfin/plot/plot.cpp) look >> suspiciously like a memory leak. Can one of the plot developers >> confirm either way? > > Yes, we need a better solution here. The problem is that we have the > interface where one both in cpp and python can do > > plot(some_plottable_object) > > and the plot window should stay on the screen even if the user doesn't > store the returned pointer to the plotter object. So where should this > object be deleted? And if we return a shared_ptr to the plotter > object, wouldn't it be deleted immediately in this case? > > Benjamin > >> >> Garth >> >> _______________________________________________ >> Mailing list: https://launchpad.net/~dolfin >> Post to : dolfin@lists.launchpad.net >> Unsubscribe : https://launchpad.net/~dolfin >> More help : https://help.launchpad.net/ListHelp _______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : dolfin@lists.launchpad.net Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp