Commit 84438d97 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Removed TEST_BIGMEM.

parent e26e343d
......@@ -185,29 +185,14 @@ void kd_freeNode(kdNode *node)
}
//#define TEST_BIGMEM 1
#ifdef TEST_BIGMEM
size_t num_nodes = 0;
struct kdNode *mem_pool = NULL;
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
#endif
struct kdNode *
kd_allocNode(struct kd_point *points, size_t pivot,
kdata_t *min, kdata_t *max, int axis, int dim)
{
struct kdNode *node;
#ifdef TEST_BIGMEM
if ( num_nodes > 2*25920000 ) fprintf(stderr, "number of nodes exceeded!\n");
if ( mem_pool == NULL ) mem_pool = (kdNode *) malloc(2*25920000*sizeof(kdNode)); // 2*gridsize
pthread_mutex_lock(&mutex);
node = &mem_pool[num_nodes++];
pthread_mutex_unlock(&mutex);
#else
if ((node = (kdNode *)kd_malloc(sizeof(kdNode), "kd_allocNode (node): ")) == NULL)
return NULL;
#endif
node->split = axis;
memcpy(node->location, points[pivot].point, dim * sizeof(kdata_t));
......@@ -233,17 +218,9 @@ kd_destroyTree(struct kdNode *node)
{
if ( node == NULL ) return;
#ifdef TEST_BIGMEM
if ( mem_pool )
{
// free(mem_pool);
// num_nodes = 0;
}
#else
kd_destroyTree(node->left);
kd_destroyTree(node->right);
kd_freeNode(node);
#endif
}
/* end of tree construction and destruction */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment