Destroy hash table and free all memory
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(json_hash_table), | intent(inout) | :: | me |
subroutine hash_table_destroy(me) class(json_hash_table), intent(inout) :: me integer(IK) :: i !! counter type(hash_node_t), pointer :: current, temp if (.not. allocated(me%buckets)) return ! Free all linked lists do i = 0, me%capacity - 1 current => me%buckets(i)%next do while (associated(current)) temp => current current => current%next if (allocated(temp%key)) deallocate(temp%key) deallocate(temp) end do end do deallocate(me%buckets) me%size = 0_IK ! also destroy the JSON core instance call me%json%destroy() end subroutine hash_table_destroy