Henning,

Both of your points are valid, and being worked on. Once we complete the
port, and have solid set of rules on the various cases where this question
arises, we will write that down and have it available for all through in the
project docs.

Implementing boost::shared_ptr is work on progress, as are some other
things. Generally, we'd like to avoid ref-counting on places where it's not
really necessary, and will manage memory using raw pointers, to gain as much
performance as we can. A few classes leave us no choice but to use
ref-counting, which we are working on porting to shared_ptr. All classes
exported to the user should have typedef's allowing you to use shared_ptr
easily.

But, as I said, this is still work on progress. If you'd like to assist us
with this, please drop me a line.

Itamar. 

-----Original Message-----
From: Henning Meyer [mailto:[email protected]] 
Sent: Tuesday, December 08, 2009 10:59 PM
To: [email protected]
Subject: [CLucene-dev] CLucene Memory Management

Hello All,

I'm obviously a CLucene Newbie. And as such I'm still confused about the
memory management/ ownership in CLucene.
Where do I find an overview which Objects are owned (and have to be
deleted) by whom? Which calls delegate ownership from user to library?
Which calls produce user-deletable objects?

So far I seemed to found out that:
Field *f;
Document::add( *f ); // delegates ownership of f to library

Term *t;
TermQuery tq(t);// delegates ownership of t to library

TCHAR c = Query::toString(NULL); // delegates ownership of c to user

But:
IndexSearcher::seach( &tq ); // leaves ownership of &tq with user

I don't really understand why CLuncene is using raw pointers after all?
That's pretty old-school C++ in my opinion. Why not boost::shared_ptr or
similar instead?

Henning

----------------------------------------------------------------------------
--
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
CLucene-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clucene-developers



------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
CLucene-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clucene-developers

Reply via email to