On Tue, Jul 06, 2004 at 12:31:43PM -0700, Windmueller, David wrote:
> 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 not seeing it. I only tested with valgrind, but you might try and
recompile with memory debugging (./configure --help).
moseley@bumby:~$ cat leak.c
#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, "swishrank swishtitle");
//SwishSetSort(mySearch, "swishtitle swishrank");
i=0;
while (i<15) {
myResults = SwishExecute(mySearch, "not dkdkd");
printf("%d Hits %d\n", i,SwishHits(myResults));
Free_Results_Object(myResults);
printf("Freed\n");
i++;
}
Free_Search_Object( mySearch );
SwishClose (myHandle);
}
moseley@bumby:~$ valgrind --leak-check=yes leak
==30547== Memcheck, a memory error detector for x86-linux.
==30547== Copyright (C) 2002-2004, and GNU GPL'd, by Julian Seward.
==30547== Using valgrind-2.1.1, a program supervision framework for x86-linux.
==30547== Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward.
==30547== For more details, rerun with: -v
==30547==
0 Hits 1
Freed
1 Hits 1
Freed
2 Hits 1
Freed
3 Hits 1
Freed
4 Hits 1
Freed
5 Hits 1
Freed
6 Hits 1
Freed
7 Hits 1
Freed
8 Hits 1
Freed
9 Hits 1
Freed
10 Hits 1
Freed
11 Hits 1
Freed
12 Hits 1
Freed
13 Hits 1
Freed
14 Hits 1
Freed
==30547==
==30547== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 17 from 1)
==30547== malloc/free: in use at exit: 0 bytes in 0 blocks.
==30547== malloc/free: 670 allocs, 670 frees, 5427653 bytes allocated.
==30547== For counts of detected errors, rerun with: -v
==30547== No malloc'd blocks -- no leaks are possible.
moseley@bumby:~$
--
Bill Moseley
moseley@hank.org
Unsubscribe from or help with the swish-e list:
http://swish-e.org/Discussion/
Help with Swish-e:
http://swish-e.org/current/docs
swish-e@sunsite.berkeley.edu
Received on Tue Jul 6 13:05:56 2004