Hi All, Hi Itamar, I'm not a CLucene developer (yet), but interested in this particular development, because as a C++ developer and CLucene User I was quite confused by the way Object ownership is handled and by the amount of mails regarding memory leaks in this mailing list. So I'm thinking this is a big chance and I'm really looking forward to what is coming as a result of this RFC.
Q1: As general suggestion I'd propose an approach I've learned from ITK (www.itk.org). There they provide a typedef: SomeITKClass::Pointer with each class. So I'd propose to define types like Term::ScopedPtr, Term::AutoPtr, Term::SharedPtr and Term::WeakPtr for each major Object in CLucene. These types can then be used internally as well as externally. Also I'd encourage use of References instead of Pointers, whereever possible. Maybe this way some use of Pointers could be circumvented at all. Q2: Overall I'd recommend to get rid of all raw pointers in the long run. With boost::scoped_ptr and std::auto_ptr C++ offers two Pointer types with almost no performace issues. You might think there is little gain from using these, but at a closer look you'll recognize you get various syntactic checks and proper resource handling in case of exceptions for free. When it comes to reference counts I agree with Itamar and go for boost::shared_ptr and boost::weak_ptr. It might also be worthwhile to have a look at boost::array (basically type safe, constant length C-Array with bounds checks in debug mode). Furthermore I wonder why CLucene is using C-Strings instead of std::basic_string - or is this really tough stuff to touch interally? Those are my bits of thoughts on these topics. Regards, Henning ------------------------------------------------------------------------------ Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev _______________________________________________ CLucene-developers mailing list CLucene-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/clucene-developers