mem_tree Function

public function mem_tree(tree) result(res)

Uses

    • forgex_syntax_tree_node_m

Arguments

Type IntentOptional Attributes Name
type(tree_node_t), intent(in) :: tree(:)

Return Value integer


Source Code

   function mem_tree(tree) result(res)
      use :: forgex_syntax_tree_node_m
      implicit none
      type(tree_node_t), intent(in) :: tree(:)
      integer :: res, sum_c, i

      res = size(tree, dim=1) * 6 * 4 ! 5 int32, 1 logical

      sum_c = 0
      do i = lbound(tree, dim=1), ubound(tree,dim=1)
         if (allocated(tree(i)%c)) then
            sum_c = sum_c + size(tree(i)%c) * 8 ! 8bytes per segment
         end if
      end do
      res = res + sum_c

   end function mem_tree