[R] Arules: R Crashes when running eclat with tidLists=TRUE

Tom D. Harray tomdharray at gmail.com
Sat Jun 4 03:08:29 CEST 2011


Update

I had the chance to test the issue tonight using R version 2.12.2
on a Linux (Ubuntu 10.04.2, x86_64, kernel 2.6.32-32-generic) system:

It does also crash (with a support of 0.01 instead of 0.05 posted
earlier) running

	eclat(Adult, parameter=list(support=0.01, tidLists=TRUE))

but I got some more information, which supports my initial guess:

	 *** caught segfault ***
	address 0xa481b70, cause 'memory not mapped'

	Traceback:
	 1: .Call("reclat", items at p, items at i, items at Dim, parameter,
                   control, data at itemInfo, PACKAGE = "arules")
	 2: eclat(Adult, parameter = list(support = 0.01,
                   tidLists = TRUE))

It also crashes on a virtual x86_32 Windows XP Home SP3 running on the
same linux machine ...


Does anyone know how to fix the problem and how?


Thanks and regards,

Dirk


> Hello,
> 
> I'm using the eclat function of the arules package (1.0-6) for the
> identification of frequent itemsets. I need the tidLists, but if I set
> in the function tidLists=TRUE R crashes (Windows XP Professional SP3,
> 32 bit, R version 2.12.1 (2010-12-16), reproducible on two different
> computers) with two different error messages or non at all. Minimum
> examples are:
> 
> 	library(arules)
> 	data("Adult")
> 
> 	eclat(Adult, parameter=list(support=0.05, tidLists=FALSE)) # OK
> 	eclat(Adult, parameter=list(support=0.50, tidLists=TRUE))  # OK
> 	eclat(Adult, parameter=list(support=0.05, tidLists=TRUE))  # crashes
> 
> I started to search the cause of the problem and figured out that the
> problem must be  located in the external function reclat called in
> eclat.R using the source of the arules package:
> 
>     result <- .Call("reclat",
>         ## transactions
>         items at p,
>         items at i,
>         items at Dim,
>         ## parameter
>         parameter, control,
>         data at itemInfo,
>         PACKAGE = "arules")
> 
> Then I looked into the source code of reclat.c, trying to follow the
> tidList=TRUE parameter, but I have no C programming experience. It
> looks to me that the problem may be in the item set report function
> "_report_R" where memory is allocated and or released (see code
> fragments below).
> 
> My question are:
> 
> a) Does anyone else can confirm the problem?
> 
> b) Does anyone know, if this may be a problem of the binary package
> (e.g. how it was compiled) or if it is a problem of the source code
> for reclat?
> 
> c) Does anyone know how to fix the problem and how?
> 
> Thanks and regards,
> 
> Dirk
> 
> 
> /*----------------------------------------------------------------------
>   Item Set Report Function
> ----------------------------------------------------------------------*/
> 
> static void _report_R (int *ids, int cnt, int supp, int *tal, void *data)
> {
> (...)
> 
> 	if (flags & OF_LIST) {
> 			  vec1 = (int*)realloc(ruleset->trnb, size1 *sizeof(int));
> 			  if (!vec1) {
> 				  if (vec) free(vec);
> 				  if (vec2) free(vec2);
> 				  _cleanup(); error(msg(E_NOMEM));}
> 			  ruleset->trnb = vec1;
> 		  }
> (...)
> 	if (flags & OF_LIST) {        /* if to list the transactions, */
> 	  h = ruleset->trtotal;
> 	  if (supp < 0) {             /* if bit vector representation */
> 		  for (i = 0; i < tacnt; i++) {  /* traverse the bit vector */
> 			  if (h >= size2) {
> 				  size2 += (size2 > BLKSIZE) ? (size2 >> 1) : BLKSIZE;
> 				  vec1 = (int*)realloc(ruleset->trans, size2 *sizeof(int));
> 				  if (!vec1) {
> 					  if (vec) free(vec);
> 					  if (vec2) free(vec2);
> 					  _cleanup(); error(msg(E_NOMEM));}
> 				  ruleset->trans = vec1;
> 			  }
> 			  if (tal[i >> BM_SHIFT] & (1 << (i & BM_MASK))) {
> 				  /*Rprintf(" %d", i+1);*/
> 				  ruleset->trans[h] = i;
> 				  h++;
> 			  }
> 		  }
> 	  }                       /* print the indices of set bits */
> 	  else {                      /* if list of transaction ids */
> 		  if ((h + supp) >= size2) {
> 			  while ((h + supp) >= size2) {
> 				  size2 += (size2 > BLKSIZE) ? (size2 >> 1) : BLKSIZE;
> 			  }
> 			  vec1 = (int*)realloc(ruleset->trans, size2 *sizeof(int));
> 			  if (!vec1) {
> 				  if (vec) free(vec);
> 				  if (vec2) free(vec2);
> 				  _cleanup(); error(msg(E_NOMEM));}
> 			  ruleset->trans = vec1;
> 		  }
> 		  for (i = 0; i < supp; i++) {
> 			  /*Rprintf(" %d", tal[i]); */
> 			  ruleset->trans[h] = tal[i];
> 			  h++;
> 		  }                           /* traverse and print */
> 	  }
> 	  ruleset->trtotal = ruleset->trnb[ruleset->rnb] = h;
> 	}                             /* the transaction identifiers */
> (...)



More information about the R-help mailing list