Skip to content

Commit

Permalink
Restore and ajdust deallocate_str1d
Browse files Browse the repository at this point in the history
  • Loading branch information
Manangka committed Jan 22, 2025
1 parent e5b2085 commit 68b1fee
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/Utilities/Memory/MemoryManager.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1937,8 +1937,36 @@ subroutine deallocate_str1d(astr1d, name, mem_path)
character(len=*), dimension(:), pointer, contiguous, intent(inout) :: astr1d !< array of strings
character(len=*), optional, intent(in) :: name !< variable name
character(len=*), optional, intent(in) :: mem_path !< path where variable is stored
! -- local
type(MemoryType), pointer :: mt
logical(LGP) :: found
type(MemoryContainerIteratorType), allocatable :: itr
! -- code
return
!
found = .false.
if (present(name) .and. present(mem_path)) then
call get_from_memorystore(name, mem_path, mt, found)
nullify (mt%astr1d)
else
itr = memorystore%iterator()
do while (itr%has_next())
call itr%next()
mt => itr%value()
if (associated(mt%astr1d, astr1d)) then
found = .true.
exit
end if
end do
end if

if (found) then
if (mt%master) then
deallocate (astr1d)
else
nullify (astr1d)
end if
end if

end subroutine deallocate_str1d

!> @brief Deallocate an array of deferred-length character strings
Expand Down

0 comments on commit 68b1fee

Please sign in to comment.