Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
84438d97
Commit
84438d97
authored
Nov 03, 2017
by
Uwe Schulzweida
Browse files
Removed TEST_BIGMEM.
parent
e26e343d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/kdtreelib/kdtree_common.cc
View file @
84438d97
...
...
@@ -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 */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment