From 1d6a85394e1e584bd0cffad17341e90a45c862e2 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Wed, 7 May 2014 18:17:28 -0400 Subject: [PATCH] fixed some memory leaks --- src/global.F90 | 23 ++++++++++++++++++++++- src/plot.F90 | 3 +++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/global.F90 b/src/global.F90 index 57e849b955..3987698f0d 100644 --- a/src/global.F90 +++ b/src/global.F90 @@ -481,8 +481,29 @@ contains call sab_dict % clear() call xs_listing_dict % clear() - ! Clear statepoint batch set + ! Clear statepoint and sourcepoint batch set call statepoint_batch % clear() + call sourcepoint_batch % clear() + + ! Deallocate entropy mesh + if (associated(entropy_mesh)) then + if (allocated(entropy_mesh % lower_left)) & + deallocate(entropy_mesh % lower_left) + if (allocated(entropy_mesh % upper_right)) & + deallocate(entropy_mesh % upper_right) + if (allocated(entropy_mesh % width)) deallocate(entropy_mesh % width) + deallocate(entropy_mesh) + end if + + ! Deallocate ufs + if (allocated(source_frac)) deallocate(source_frac) + if (associated(ufs_mesh)) then + if (allocated(ufs_mesh % lower_left)) deallocate(ufs_mesh % lower_left) + if (allocated(ufs_mesh % upper_right)) & + deallocate(ufs_mesh % upper_right) + if (allocated(ufs_mesh % width)) deallocate(ufs_mesh % width) + deallocate(ufs_mesh) + end if end subroutine free_memory diff --git a/src/plot.F90 b/src/plot.F90 index 9e8348db7f..7ad178a7d9 100644 --- a/src/plot.F90 +++ b/src/plot.F90 @@ -175,6 +175,9 @@ contains ! Free up space call deallocate_image(img) + ! Clear particle + call p % clear() + end subroutine create_ppm !===============================================================================