Skip to content

Commit

Permalink
Merge pull request #1053 from CEED/natalie/fix-magma-jit-mem
Browse files Browse the repository at this point in the history
Fix small memory leaks in JIT source code management
  • Loading branch information
jeremylt authored Aug 30, 2022
2 parents 11a69ce + 9af6094 commit 01005ea
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backends/magma/ceed-magma-basis.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,11 @@ int CeedBasisCreateTensorH1_Magma(CeedInt dim, CeedInt P1d, CeedInt Q1d,
data->queue);

ierr = CeedBasisSetData(basis, impl); CeedChkBackend(ierr);
ierr = CeedFree(&magma_common_path); CeedChkBackend(ierr);
ierr = CeedFree(&interp_path); CeedChkBackend(ierr);
ierr = CeedFree(&grad_path); CeedChkBackend(ierr);
ierr = CeedFree(&weight_path); CeedChkBackend(ierr);
ierr = CeedFree(&basis_kernel_source); CeedChkBackend(ierr);

return CEED_ERROR_SUCCESS;
}
Expand Down
3 changes: 3 additions & 0 deletions backends/magma/ceed-magma-restriction.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@ int CeedElemRestrictionCreate_Magma(CeedMemType mtype, CeedCopyMode cmode,
CeedChkBackend(ierr);
ierr = CeedSetBackendFunction(ceed, "ElemRestriction", r, "Destroy",
CeedElemRestrictionDestroy_Magma); CeedChkBackend(ierr);
ierr = CeedFree(&restriction_kernel_path); CeedChkBackend(ierr);
ierr = CeedFree(&restriction_kernel_source); CeedChkBackend(ierr);

return CEED_ERROR_SUCCESS;
}

Expand Down
1 change: 1 addition & 0 deletions interface/ceed-jit-tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ int CeedLoadSourceToInitializedBuffer(Ceed ceed,
memcpy(ceed_relative_path, &next_left_chevron[1], ceed_relative_path_length);
ierr = CeedGetJitAbsolutePath(ceed, ceed_relative_path, &include_source_path);
CeedChk(ierr);
ierr = CeedFree(&ceed_relative_path); CeedChk(ierr);
}
// ---- Recursive call to load source to buffer
CeedDebug256(ceed, 2, "JiT Including: %s\n", include_source_path);
Expand Down

0 comments on commit 01005ea

Please sign in to comment.