Skip to main content.
home | support | download

Back to List Archive

Memory Leak with Sort Parameters including swishrank

From: Windmueller, David <DWindmueller(at)not-real.bloomberg.com>
Date: Tue Jul 06 2004 - 19:31:48 GMT
Hello,

I think I've found a memory 'leak' when using multiple sort parameters and the first one is swishrank.  The code below has two SetSort lines.  If I use the one with swishrank first, the size of the process grows and grows, but if use the other one the size stays constant after the first search.

I'm looking through the code, but I thought I'd throw this out to see if I'm overlooking something.


-David



-----------------------------------------------
#include <stdio.h>
#include "swish-e.h"

int main () {

	SW_HANDLE myHandle = NULL;
	SW_SEARCH mySearch = NULL;
	SW_RESULTS myResults = NULL;
    int i;

	/* Swish-e Setup */
	myHandle = SwishInit ("foo.index");
	
	if (!myHandle) {
		printf("Unable to Create Handle\n");
		exit(1);
	}

	if ( SwishError(myHandle) ) {
		printf ("Swish Init Error %s\n", SwishErrorString(myHandle) );
		exit(1);
	}

	mySearch = New_Search_Object(myHandle,"");

	if (!myHandle) {
		printf("Unable to Create Search Object\n");
		exit(1);
	}
	SwishSetSort(mySearch, "swishrank swishtitle");
	/*SwishSetSort(mySearch, "swishtitle swishrank"); */
	
    i=0;
	sleep(15);
	while (i<15) {
		myResults = SwishExecute(mySearch, "David Martin");
		printf("%d Hits %d\n", i,SwishHits(myResults));

		sleep(20);
		Free_Results_Object(myResults);
		printf("Freed\n");

/*		Free_Search_Object(mySearch);
		mySearch = New_Search_Object(myHandle,"");
*/
		sleep(5);
		i++;
	}
    SwishClose (myHandle);

	sleep(30);
}
Received on Tue Jul 6 12:32:00 2004