Can't you just call clear() in ~MyPreconditioner()?
Tim Kroeger wrote: > Dear all, > > There is a misleading matter in the Preconditioner class. That is, > the virtual destructor calls clear(), which is itself a virtual > function that does nothing. In my derived class (let's call it > MyPreconditioner), I am overloading the clear() method to free some > memory that is allocated in MyPreconditioner::init(). However, this > led to a memory leak since calls to virtual member functions in > destructors (likewise in constructors) do *not* call the function of > the derived class. This is an exception of the concept of virtual > functions; it is meant to prevent calls to functions of uninitialized > classes. > > I would suggest to remove the clear() function from the class, as in > the attached patch, to avoid this confusion. Actually, I thinkt that > there is really no point in having this clear() method since the only > point in the library where it is called is the destructor, but there > it doesn't have any effect as described above. > > What do you think? I would like to hear your feedback before I check > that in. > > Best Regards, > > Tim > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > ------------------------------------------------------------------------ > > _______________________________________________ > Libmesh-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/libmesh-devel ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Libmesh-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libmesh-devel
