[Xapian-discuss] value range in perl
Olly Betts
olly at survex.com
Sat Oct 27 03:58:17 BST 2007
On Fri, Oct 26, 2007 at 04:40:50PM -0400, Jim Spath wrote:
> I'm a bit confused about the nature of the leak.
>
> Do both of these leak in 1.0.2?
>
> ====
>
> $qp->add_valuerangeprocessor(
> new Search::Xapian::DateValueRangeProcessor(0)
> );
>
> ====
>
> my ($vrp, $qp);
> [...]
> $vrp = new Search::Xapian::DateValueRangeProcessor(0);
> $qp->add_valuerangeprocessor($vrp);
Yes - any ValueRangeProcessor object passed to
QueryParser::add_valuerangeprocessor() currently gets its reference
count bumped, so won't get deleted. Stopper objects get the same
treatment.
I realise this isn't ideal, but it seems the best short term option
as several people were bitten by calling new inline like the first
example. If there's a consensus that leaking is worse, I'm happy
to change this back.
There are two ways I can see to address this properly - one is to keep a
reference to any perl ValueRangeProcessor objects passed to
QueryParser::add_valuerangeprocessor() in each perl QueryParser object.
The other is to fix this in the C++ API - this issue also occurs for
the other language bindings, and it's an annoyance in C++ too, so this
seems the best place to address this, but that will involve API changes
so would have to wait until 1.1.0. We haven't yet discussed a date
for 1.1.0 yet, but I'd guess it's likely to be some time in the first
half of next year.
Given infinite resources we'd of course fix it the perl-specific way in
the meantime, but sadly we have to prioritise. But if you (or anyone
else) don't mind getting your hands dirty with a bit of XS wrangling, a
patch would certainly be most welcome.
Cheers,
Olly
More information about the Xapian-discuss
mailing list