[Xapian-discuss] File Descriptors

Mike Boone mike at boonedocks.net
Tue Feb 1 03:04:00 GMT 2005


Richard Boulton wrote:

"All file descriptors used by a Xapian database should be released when
the database is closed, so as long as there isn't a bug in PHP-SWIG
which is failing to delete databases after use, there shouldn't be a
problem that raising the limit won't solve.  I haven't looked at the PHP
bindings in detail, but it looks like you are meant to explicitly delete
database (and other Xapian objects) after use, so it would be worth
making sure that you're doing that."

I'm confused about when to explictly delete objects. When I first started
with Xapian, months ago, I used database_Delete explicitly when I was
finished with it. But I seem to recall errors because of this (wish I had
written them down), so I stopped deleting explicitly and I have not had a
problem since (unless this file descriptor stuff is related). The Xapian
0.8.3 simplesearch.php example does not explicitly delete the database. On
the other hand, simpleindex.php DOES explicitly delete via
delete_WritableDatabase. So I mimicked that in my indexing code.

Most of the delete functions in php4/xapian_wrap.cc have this comment:

/* This function is designed to be called by the zend list destructors to
typecast and do the actual destruction */

I don't know what that means, but I'm thinking that Zend is supposed to call
it, not me.

Can anyone elaborate on when to explicitly delete objects?

Thanks,
Mike.




More information about the Xapian-discuss mailing list