cleanup wallace arrays on program termination
This commit is contained in:
parent
590fc543f8
commit
83c99bece4
|
|
@ -70,6 +70,13 @@ void PolarGauss(double* py1, double* py2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void destroy_wallace(void)
|
||||||
|
{
|
||||||
|
tfree(pool1);
|
||||||
|
tfree(pool2);
|
||||||
|
tfree(addrif);
|
||||||
|
tfree(addrib);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void initw(void)
|
void initw(void)
|
||||||
|
|
@ -87,10 +94,12 @@ void initw(void)
|
||||||
newpools = 1;
|
newpools = 1;
|
||||||
|
|
||||||
/* set up the two pools */
|
/* set up the two pools */
|
||||||
pool1 = TMALLOC(double, n); //(double*)malloc(n * sizeof(double));
|
pool1 = TMALLOC(double, n);
|
||||||
pool2 = TMALLOC(double, n); //(double*)malloc(n * sizeof(double));
|
pool2 = TMALLOC(double, n);
|
||||||
addrif = TMALLOC(unsigned int, (n + NOTRANS)); //(unsigned int*)malloc((n + NOTRANS) * sizeof(unsigned int));
|
addrif = TMALLOC(unsigned int, (n + NOTRANS));
|
||||||
addrib = TMALLOC(unsigned int, (n + NOTRANS)); //(unsigned int*)malloc((n + NOTRANS) * sizeof(unsigned int));
|
addrib = TMALLOC(unsigned int, (n + NOTRANS));
|
||||||
|
|
||||||
|
atexit(destroy_wallace);
|
||||||
|
|
||||||
/* fill the first pool with normally distributed values */
|
/* fill the first pool with normally distributed values */
|
||||||
PolarGauss(&pool1[0], &pool1[1]);
|
PolarGauss(&pool1[0], &pool1[1]);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue