Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory issues #209

Merged
merged 1 commit into from
Feb 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions python/meep.i
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ meep::volume_list *make_volume_list(const meep::volume &v, int c,
if (((material_data *)$1.material)->medium.H_susceptibilities.items) {
delete[] ((material_data *)$1.material)->medium.H_susceptibilities.items;
}
delete (material_data *)$1.material;
free((material_data *)$1.material);
geometric_object_destroy($1);
}
}
Expand Down Expand Up @@ -426,7 +426,7 @@ meep::volume_list *make_volume_list(const meep::volume &v, int c,
if (((material_data *)$1.items[i].material)->medium.H_susceptibilities.items) {
delete[] ((material_data *)$1.items[i].material)->medium.H_susceptibilities.items;
}
delete (material_data *)$1.items[i].material;
free((material_data *)$1.items[i].material);
geometric_object_destroy($1.items[i]);
}
delete[] $1.items;
Expand Down Expand Up @@ -539,7 +539,7 @@ meep::volume_list *make_volume_list(const meep::volume &v, int c,
if ($1->medium.H_susceptibilities.items) {
delete[] $1->medium.H_susceptibilities.items;
}
delete $1;
free($1);
}

// Typemap suite for array_slice
Expand Down Expand Up @@ -775,7 +775,7 @@ meep::volume_list *make_volume_list(const meep::volume &v, int c,
if ($1.items[i]->medium.H_susceptibilities.items) {
delete[] $1.items[i]->medium.H_susceptibilities.items;
}
delete $1.items[i];
free($1.items[i]);
}
delete[] $1.items;
}
Expand Down
1 change: 1 addition & 0 deletions src/structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ structure_chunk::structure_chunk(const structure_chunk *o) : v(o->v) {
FOR_FIELD_TYPES(ft) {
{
susceptibility *cur = NULL;
chiP[ft] = NULL;
for (const susceptibility *ocur = o->chiP[ft]; ocur; ocur = ocur->next) {
if (cur) { cur->next = ocur->clone(); cur = cur->next; }
else { chiP[ft] = cur = ocur->clone(); }
Expand Down