jean.coursol@math.u-psud.fr
2003-Nov-25 15:37 UTC
[Rd] dwilcox , pwilcox, qwilcox are not freeing memory (PR#5314)
Full_Name: jean coursol
Version: 1.7.1, 1.8.0
OS: linux
Submission from: (NULL) (129.175.52.7)
w <- pwilcox(1000,50,50) allocates the whole memory and freezes the system
or qwilcox
or dwilcox
To fix the problem: in wilcox.c, call wilcox_free() before return in the three
functions dwilcox, qwilcox, pwilcox.
*** R-1.8.0/src/nmath/wilcox.c Thu Jul 17 13:13:17 2003
--- R-1.8.0/src/nmath/wilcox.patched.c Tue Nov 18 09:56:19 2003
*************** double dwilcox(double x, double m, doubl
*** 162,168 ****
d = give_log ?
log(cwilcox(x, m, n)) - lchoose(m + n, n) :
cwilcox(x, m, n) / choose(m + n, n);
!
return(d);
}
--- 162,168 ----
d = give_log ?
log(cwilcox(x, m, n)) - lchoose(m + n, n) :
cwilcox(x, m, n) / choose(m + n, n);
+ wilcox_free(); /* JC */
return(d);
}
*************** double pwilcox(double x, double m, doubl
*** 202,208 ****
p += cwilcox(i, m, n) / c;
lower_tail = !lower_tail; /* p = 1 - p; */
}
!
return(R_DT_val(p));
} /* pwilcox */
--- 202,208 ----
p += cwilcox(i, m, n) / c;
lower_tail = !lower_tail; /* p = 1 - p; */
}
+ wilcox_free(); /* JC */
return(R_DT_val(p));
} /* pwilcox */
*************** double qwilcox(double x, double m, doubl
*** 255,261 ****
q++;
}
}
!
return(q);
}
--- 255,261 ----
q++;
}
}
+ wilcox_free(); /* JC */
return(q);
}
maechler@stat.math.ethz.ch
2003-Nov-25 16:12 UTC
[Rd] dwilcox , pwilcox, qwilcox are not freeing memory (PR#5314)
>>>>> "jean" == jean coursol <jean.coursol@math.u-psud.fr> >>>>> on Tue, 25 Nov 2003 15:33:58 +0100 (CET) writes:jean> Full_Name: jean coursol Version: 1.7.1, 1.8.0 OS: jean> linux Submission from: (NULL) (129.175.52.7) jean> w <- pwilcox(1000,50,50) allocates the whole memory jean> and freezes the system or qwilcox or dwilcox jean> To fix the problem: in wilcox.c, call wilcox_free() jean> before return in the three functions dwilcox, qwilcox, jean> pwilcox. That can hardly be the general idea! Note that the R functions [dpq]wilcox() are **vectorized**, and the whole purpose of the code is to only compute the tables once per R call -- which is often many calls to the corresponding C functions.