Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
code
pugs
Commits
3af3dc12
Commit
3af3dc12
authored
4 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Plain Diff
Merge branch 'issue/petsc-memory-leaks' into 'develop'
Fix memory leaks when using PETSc See merge request
!73
parents
665c808d
8526bdc3
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!73
Fix memory leaks when using PETSc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/algebra/LinearSolver.cpp
+6
-6
6 additions, 6 deletions
src/algebra/LinearSolver.cpp
with
6 additions
and
6 deletions
src/algebra/LinearSolver.cpp
+
6
−
6
View file @
3af3dc12
...
@@ -179,12 +179,6 @@ struct LinearSolver::Internals
...
@@ -179,12 +179,6 @@ struct LinearSolver::Internals
Vec
petscX
;
Vec
petscX
;
VecCreateMPIWithArray
(
PETSC_COMM_WORLD
,
1
,
x
.
size
(),
x
.
size
(),
&
x
[
0
],
&
petscX
);
VecCreateMPIWithArray
(
PETSC_COMM_WORLD
,
1
,
x
.
size
(),
x
.
size
(),
&
x
[
0
],
&
petscX
);
Mat
petscMat
;
MatCreate
(
PETSC_COMM_WORLD
,
&
petscMat
);
MatSetSizes
(
petscMat
,
PETSC_DECIDE
,
PETSC_DECIDE
,
x
.
size
(),
x
.
size
());
MatSetType
(
petscMat
,
MATAIJ
);
Array
<
PetscScalar
>
values
=
copy
(
A
.
values
());
Array
<
PetscScalar
>
values
=
copy
(
A
.
values
());
const
auto
A_row_indices
=
A
.
rowIndices
();
const
auto
A_row_indices
=
A
.
rowIndices
();
...
@@ -202,6 +196,7 @@ struct LinearSolver::Internals
...
@@ -202,6 +196,7 @@ struct LinearSolver::Internals
}
}
}
}
Mat
petscMat
;
MatCreateSeqAIJWithArrays
(
PETSC_COMM_WORLD
,
x
.
size
(),
x
.
size
(),
&
row_indices
[
0
],
&
column_indices
[
0
],
&
values
[
0
],
MatCreateSeqAIJWithArrays
(
PETSC_COMM_WORLD
,
x
.
size
(),
x
.
size
(),
&
row_indices
[
0
],
&
column_indices
[
0
],
&
values
[
0
],
&
petscMat
);
&
petscMat
);
...
@@ -292,7 +287,12 @@ struct LinearSolver::Internals
...
@@ -292,7 +287,12 @@ struct LinearSolver::Internals
}
}
KSPSolve
(
ksp
,
petscB
,
petscX
);
KSPSolve
(
ksp
,
petscB
,
petscX
);
// free used memory
MatDestroy
(
&
petscMat
);
MatDestroy
(
&
petscMat
);
VecDestroy
(
&
petscB
);
VecDestroy
(
&
petscX
);
KSPDestroy
(
&
ksp
);
}
}
#else // PUGS_HAS_PETSC
#else // PUGS_HAS_PETSC
...
...
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