Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libcdi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
mpim-sw
libcdi
Commits
b049888a
Commit
b049888a
authored
12 years ago
by
Thomas Jahns
Browse files
Options
Downloads
Patches
Plain Diff
Fix memory leaks in test program.
parent
a8da8d78
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/pio_write.c
+13
-8
13 additions, 8 deletions
tests/pio_write.c
with
13 additions
and
8 deletions
tests/pio_write.c
+
13
−
8
View file @
b049888a
...
...
@@ -96,7 +96,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
int
vlistID
,
varIDs
[
nVars
],
streamID
,
tsID
,
tfID
=
0
;
int
i
,
varID
,
nmiss
=
0
;
double
*
lons
,
*
lats
;
double
*
var
=
NULL
,
*
varslice
;
double
*
var
=
NULL
,
*
varslice
=
NULL
;
double
mscale
,
mrscale
;
time_t
current_time
;
int
vdate
=
19850101
,
vtime
=
120000
;
...
...
@@ -104,7 +104,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
char
filename
[
1024
];
int
nlon
=
setup
.
nlon
,
nlat
=
setup
.
nlat
;
uint32_t
checksum_state
[
nVars
];
size_t
varSize
[
nVars
],
varslice_size
;
size_t
varSize
[
nVars
],
varslice_size
=
0
;
int
*
nlev
;
double
*
levs
;
#if USE_MPI
...
...
@@ -128,10 +128,10 @@ modelRun(struct model_config setup, MPI_Comm comm)
gridID
=
gridCreate
(
GRID_LONLAT
,
nlon
*
nlat
);
gridDefXsize
(
gridID
,
nlon
);
gridDefYsize
(
gridID
,
nlat
);
lons
=
malloc
(
nlon
*
sizeof
(
lons
[
0
]));
lons
=
x
malloc
(
nlon
*
sizeof
(
lons
[
0
]));
for
(
i
=
0
;
i
<
nlon
;
++
i
)
lons
[
i
]
=
((
double
)(
i
*
360
))
/
nlon
;
lats
=
malloc
(
nlat
*
sizeof
(
lats
[
0
]));
lats
=
x
malloc
(
nlat
*
sizeof
(
lats
[
0
]));
for
(
i
=
0
;
i
<
nlat
;
++
i
)
lats
[
i
]
=
((
double
)(
i
*
180
))
/
nlat
-
90
.
0
;
gridDefXvals
(
gridID
,
lons
);
...
...
@@ -150,9 +150,6 @@ modelRun(struct model_config setup, MPI_Comm comm)
zaxisDefLevels
(
zaxisID
[
i
],
levs
);
}
varslice
=
NULL
;
varslice_size
=
0
;
vlistID
=
vlistCreate
();
for
(
i
=
0
;
i
<
nVars
;
i
++
)
...
...
@@ -265,6 +262,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
}
}
}
free
(
varslice
);
pioEndTimestepping
();
streamClose
(
streamID
);
vlistDestroy
(
vlistID
);
...
...
@@ -272,6 +270,13 @@ modelRun(struct model_config setup, MPI_Comm comm)
for
(
i
=
0
;
i
<
nVars
;
i
++
)
zaxisDestroy
(
zaxisID
[
i
]
);
gridDestroy
(
gridID
);
#if USE_MPI
free
(
displs
);
free
(
chunks
);
free
(
var
);
#endif
free
(
nlev
);
free
(
levs
);
free
(
lats
);
free
(
lons
);
}
...
...
@@ -384,7 +389,7 @@ int main (int argc, char *argv[])
int
nProcsIO
=
2
;
xmpi
(
MPI_Init
(
&
argc
,
&
argv
));
xmpi
(
MPI_Comm_dup
(
MPI_COMM_WORLD
,
&
commGlob
))
;
commGlob
=
MPI_COMM_WORLD
;
xmpi
(
MPI_Comm_set_errhandler
(
commGlob
,
MPI_ERRORS_RETURN
));
xmpi
(
MPI_Comm_size
(
commGlob
,
&
sizeGlob
));
xmpi
(
MPI_Comm_rank
(
commGlob
,
&
rankGlob
));
...
...
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