Mateusz,

I recall fixing a memory leak in StopFilter or a related class for the 2.3.2
branch, and since the change was too intrusive we did not commit it to the
SVN trunk, hence it should still exist in the current release. That is the
only major leak I know exists in that codebase. However, running that demo
application now on VS2008 I could spot no memory leak.

Now, depending on your planned use for clucene, I'll second Isidor's
suggestion for using our git master HEAD for development. It is a much
better branch than we have ever had; it does have several drawbacks and
leaks, but we are constantly working on improving it. You can get it from
here:
http://clucene.git.sourceforge.net/git/gitweb.cgi?p=clucene/clucene;a=summar
y. Also available as a tarball through tree -> snapshot if you don't want to
use git, just make sure to keep up with our updates to that branch. I've
recently posted a detailed description of what's there and what still needs
to be done on the ML, it could help you decide.

If you would rather keep with the previous version, please update your copy
to the current SVN trunk, it has several fixes which weren't released yet:
http://clucene.svn.sourceforge.net/viewvc/clucene/trunk/.

Please let us know if you need any further help on deciding what's the best
fit for you.

Itamar. 

-----Original Message-----
From: Isidor Zeuner [mailto:cluc...@quidecco.de] 
Sent: Tuesday, September 22, 2009 4:33 AM
To: clucene-developers@lists.sourceforge.net
Subject: Re: [CLucene-dev] newbie confusion

Hello Mateusz,

> I'm looking for a full-text search engine, and recently got interested 
> in CLucene. However, I'm having some troubles with it, apparently 
> mainly with the memory management. For starters, I've downloaded the 
> "stable" 0.9.21 package, but trying to run the "cl_demo" (I'm using MS
> VC++ 2008 Express, compiling the default solution files provided,
> auto-converted to 2008 format) results in some memory leaks reported 
> thanks to the "_CrtSetDbgFlag()" call. Now, that makes me feel uneasy:
> shouldn't the demo app be running perfectly clean? is this a problem 
> with the app, with the library, with VC++, with some compiler flags, 
> or what?
> 

Can't tell much about 0.9.21 as I'm only working with the development
branch, but cl_demo isn't supposed to leak memory. So you might want to
report a bug on our tracker.

For starters, you might also want to have a look at the test suite, as it
contains very different uses of the CLucene API. For me, it proved as a more
useful resource to learn how to use CLucene than cl_demo.

> A bigger problem for me is that I'm overally pretty confused on how to 
> allocate objects when using CLucene. The demo app again seems pretty
> inconsistent: it mostly uses the _CLNEW macro, but sometimes normal 
> local objects (e.g. when instantiating the StandardAnalyzer). Which 
> approaches can I use, or should I use, and why? And what about the 
> regular "new" operator? Now, I thought I should be pretty safe with a 
> simple "all objects auto/local" policy, which I believe to be default 
> for C++; but I've tried to reduce the demo app to some simpler one 
> using that policy and it still reports errors on runtime.
> 

As of the current development branch, most classes are initialized and
destroyed using _CLNEW and _CLDELETE for historical reasons (_CLNEW is now
#define-ed as "new" anyway). This is due to the reference counting
implementation previously used. We are currently in the process of using
boost::shared_ptr to replace this, which will allow us to go back to the
more C++-like scope-based memory management.

> Furthermore, the demo ends in a couple of functions like 
> "_lucene_shutdown()" and "__cl_ClearMemory()" - are they mandatory, 
> and both of them? And if so, then I believe that's quite confusing for 
> them to start with an underscore.
> 

As of the current development branch, I think __cl_ClearMemory() is not used
anymore, but an application should still call
_lucene_shutdown() to clean up.

I think you raise some very valid points regarding the confusing memory
management and the underscore-prefixed API function. I hope to get some more
developer feedback on these issues and find better solutions for them.

> Finally, having looked over several posts in this mailing list, I have 
> an impression that the main work is now on the "2.3.2" branch, and 
> that it is meant to be soon released oficially to the public. Is that 
> so? Should I abandon the "stable public 0.9.21" branch and change to 
> the new one, and can I expect it to be easier and more stable/less 
> surprising?
> 

We had the same concern some weeks ago on the mailing list. Personally, I'd
say the current git development code is far more useful for 2009 search
engine application development. It is still a work in progress and API
changes are still possible, but it is already very stable and apart from
that, way faster and more powerful than the previous stable release.

> I'd be grateful for any help, also for pointing it out if I'm simply 
> doing something wrong.

I hope my comments were of some help. Maybe another developer more
experienced with the stable release can give you more comments regarding
that codebase.

I appreciate your observations because I think they allow us to improve
documentation and API architecture.

Best regards,

Isidor

----------------------------------------------------------------------------
--
Come build with us! The BlackBerry® Developer Conference in SF, CA is
the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf _______________________________________________
CLucene-developers mailing list
CLucene-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/clucene-developers




------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
CLucene-developers mailing list
CLucene-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/clucene-developers

Reply via email to