Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Aug 14, 2024
1 parent 3f7981c commit ed8f82c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/binding/python/Iteration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void init_Iteration(py::module &m)
add_pickle(
cl, [](openPMD::Series series, std::vector<std::string> const &group) {
uint64_t const n_it = std::stoull(group.at(1));
auto &res = series.iterations[n_it];
auto res = series.iterations[n_it];
return internal::makeOwning(res, std::move(series));
});

Expand Down
2 changes: 1 addition & 1 deletion src/binding/python/Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void init_Mesh(py::module &m)
add_pickle(
cl, [](openPMD::Series series, std::vector<std::string> const &group) {
uint64_t const n_it = std::stoull(group.at(1));
auto &res = series.iterations[n_it].open().meshes[group.at(3)];
auto res = series.iterations[n_it].open().meshes[group.at(3)];
return internal::makeOwning(res, std::move(series));
});

Expand Down
2 changes: 1 addition & 1 deletion src/binding/python/MeshRecordComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void init_MeshRecordComponent(py::module &m)
add_pickle(
cl, [](openPMD::Series series, std::vector<std::string> const &group) {
uint64_t const n_it = std::stoull(group.at(1));
auto &res =
auto res =
series.iterations[n_it]
.open()
.meshes[group.at(3)]
Expand Down
2 changes: 1 addition & 1 deletion src/binding/python/ParticleSpecies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void init_ParticleSpecies(py::module &m)
add_pickle(
cl, [](openPMD::Series series, std::vector<std::string> const &group) {
uint64_t const n_it = std::stoull(group.at(1));
ParticleSpecies &res =
ParticleSpecies res =
series.iterations[n_it].open().particles[group.at(3)];
return internal::makeOwning(res, std::move(series));
});
Expand Down
4 changes: 2 additions & 2 deletions src/binding/python/Record.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ void init_Record(py::module &m)
add_pickle(
cl, [](openPMD::Series series, std::vector<std::string> const &group) {
uint64_t const n_it = std::stoull(group.at(1));
auto &res = series.iterations[n_it].open().particles[group.at(3)]
[group.at(4)];
auto res = series.iterations[n_it].open().particles[group.at(3)]
[group.at(4)];
return internal::makeOwning(res, std::move(series));
});

Expand Down
11 changes: 5 additions & 6 deletions src/binding/python/RecordComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1124,12 +1124,11 @@ void init_RecordComponent(py::module &m)
add_pickle(
cl, [](openPMD::Series series, std::vector<std::string> const &group) {
uint64_t const n_it = std::stoull(group.at(1));
auto &res =
series.iterations[n_it]
.open()
.particles[group.at(3)][group.at(4)]
[group.size() < 6 ? RecordComponent::SCALAR
: group.at(5)];
auto res = series.iterations[n_it]
.open()
.particles[group.at(3)][group.at(4)]
[group.size() < 6 ? RecordComponent::SCALAR
: group.at(5)];
return internal::makeOwning(res, std::move(series));
});

Expand Down

0 comments on commit ed8f82c

Please sign in to comment.