Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
d09ac68e
Commit
d09ac68e
authored
7 years ago
by
James Willis
Browse files
Options
Downloads
Patches
Plain Diff
Free memory after use.
parent
464bf216
No related branches found
No related tags found
1 merge request
!543
Fof
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/fof.c
+15
-3
15 additions, 3 deletions
src/fof.c
with
15 additions
and
3 deletions
src/fof.c
+
15
−
3
View file @
d09ac68e
...
@@ -1161,6 +1161,14 @@ void fof_search_foreign_cells(struct space *s) {
...
@@ -1161,6 +1161,14 @@ void fof_search_foreign_cells(struct space *s) {
}
}
}
}
/* Clean up memory. */
free
(
part_links
);
free
(
interface_cells
);
free
(
group_links
);
free
(
global_group_links
);
free
(
global_group_links_offset
);
free
(
displ
);
message
(
"Rank %d finished linking local roots to foreign roots."
,
engine_rank
);
message
(
"Rank %d finished linking local roots to foreign roots."
,
engine_rank
);
#endif
/* WITH_MPI */
#endif
/* WITH_MPI */
...
@@ -1276,8 +1284,8 @@ void fof_search_tree(struct space *s) {
...
@@ -1276,8 +1284,8 @@ void fof_search_tree(struct space *s) {
group_size
,
group_id
);
group_size
,
group_id
);
#ifdef WITH_MPI
#ifdef WITH_MPI
int
*
global_group_index
,
*
global_group_size
;
int
*
global_group_index
=
NULL
,
*
global_group_size
=
NULL
,
*
displ
=
NULL
;
long
long
*
global_group_id
;
long
long
*
global_group_id
=
NULL
;
int
total_num_groups
=
0
;
int
total_num_groups
=
0
;
if
(
s
->
e
->
nr_nodes
>
1
)
{
if
(
s
->
e
->
nr_nodes
>
1
)
{
...
@@ -1297,7 +1305,7 @@ void fof_search_tree(struct space *s) {
...
@@ -1297,7 +1305,7 @@ void fof_search_tree(struct space *s) {
bzero
(
global_group_size
,
s
->
e
->
total_nr_gparts
*
sizeof
(
int
));
bzero
(
global_group_size
,
s
->
e
->
total_nr_gparts
*
sizeof
(
int
));
bzero
(
global_group_id
,
s
->
e
->
total_nr_gparts
*
sizeof
(
long
long
));
bzero
(
global_group_id
,
s
->
e
->
total_nr_gparts
*
sizeof
(
long
long
));
int
*
displ
=
NULL
;
if
(
posix_memalign
((
void
**
)
&
displ
,
SWIFT_STRUCT_ALIGNMENT
,
if
(
posix_memalign
((
void
**
)
&
displ
,
SWIFT_STRUCT_ALIGNMENT
,
s
->
e
->
nr_nodes
*
sizeof
(
int
))
!=
0
)
s
->
e
->
nr_nodes
*
sizeof
(
int
))
!=
0
)
error
(
"Error while allocating memory for FOF MPI communication"
);
error
(
"Error while allocating memory for FOF MPI communication"
);
...
@@ -1451,6 +1459,7 @@ void fof_search_tree(struct space *s) {
...
@@ -1451,6 +1459,7 @@ void fof_search_tree(struct space *s) {
message
(
"Biggest group size: %d with ID: %d"
,
max_group_size
,
max_group_index
);
message
(
"Biggest group size: %d with ID: %d"
,
max_group_size
,
max_group_index
);
message
(
"Biggest group by mass: %f with ID: %d"
,
max_group_mass
,
max_group_mass_id
);
message
(
"Biggest group by mass: %f with ID: %d"
,
max_group_mass
,
max_group_mass_id
);
/* Clean up memory. */
free
(
group_size
);
free
(
group_size
);
free
(
group_mass
);
free
(
group_mass
);
...
@@ -1459,6 +1468,9 @@ void fof_search_tree(struct space *s) {
...
@@ -1459,6 +1468,9 @@ void fof_search_tree(struct space *s) {
if
(
engine_rank
==
0
)
message
(
"Total number of groups: %d"
,
total_num_groups
);
if
(
engine_rank
==
0
)
message
(
"Total number of groups: %d"
,
total_num_groups
);
free
(
global_nr_gparts
);
free
(
global_nr_gparts
);
free
(
global_group_index
);
free
(
global_group_index
);
free
(
global_group_size
);
free
(
global_group_id
);
free
(
displ
);
}
}
#endif
/* WITH_MPI */
#endif
/* WITH_MPI */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment