From: SourceForge.net <no...@so...> - 2006-05-10 09:57:12
|
Bugs item #1484421, was opened at 2006-05-09 14:58 Message generated for change (Comment added) made by jwlcha You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=558446&aid=1484421&group_id=80013 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Landon (jwlcha) Assigned to: Nobody/Anonymous (nobody) Summary: crash when hits > maxDoc Initial Comment: Please refer to the code below, Document& Hits::doc(const int32_t n) { HitDoc* hitDoc = getHitDoc(n); // Update LRU cache of documents remove(hitDoc);// remove from list, if there addToFront(hitDoc); // add to front of list if (numDocs > maxDocs) { // if cache is full HitDoc* oldLast = last; remove(last); // flush last _CLDELETE( oldLast->doc ); //CRASHED HERE oldLast->doc = NULL; } if (hitDoc->doc == NULL) hitDoc->doc = searcher->doc(hitDoc->id); // cache miss: read document return *hitDoc->doc; } The calling code is shown below. for(__int32 i = 0; i< pHits->length(); ++ i) { Document hDoc = pHits->doc(i); } Suppose pHit->length() == 300 the program always crashes whenever i == maxDoc-1 ---------------------------------------------------------------------- >Comment By: Landon (jwlcha) Date: 2006-05-10 17:57 Message: Logged In: YES user_id=1519612 See attached for the code snippet. For your info, I'm using CLucene v0.9.10 Incidentially, v0.9.10 does not seem to have TestSearch::testSrchManyHits() ---------------------------------------------------------------------- Comment By: Landon (jwlcha) Date: 2006-05-10 17:45 Message: Logged In: YES user_id=1519612 See attached for the value of oldLast. oldLast.doc.fieldList.Field is unreferenced, Hence the crash. this time, I changed maxDoc to 1, and the number of hits was 3. Using the same calling code. The exception occurs at pHits- >doc(1). ---------------------------------------------------------------------- Comment By: Ben van Klinken (ustramooner) Date: 2006-05-09 20:05 Message: Logged In: YES user_id=763834 there is a test for this situation in TestSearch::testSrchManyHits it creates 140 documents, and does a search which returns all of them and no error occurs. i even tried to change 140 to 300. can you submit some code which demonstrates this error? are you deleting the document return from hit->doc()? the documentation says: * Memory belongs to the hits object. Don't delete the return value. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=558446&aid=1484421&group_id=80013 |