Destroy the json_value data in a json_file. This must be done when the variable is no longer needed, or will be reused to open a different file. Otherwise a memory leak will occur.
Optionally, also destroy the json_core instance (this is not necessary to prevent memory leaks, since a json_core does not use pointers).
destroy_core
argumentType | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_file), | intent(inout) | :: | me | |||
logical, | intent(in), | optional | :: | destroy_core | to also destroy the json_core. default is to leave it as is. |
subroutine json_file_destroy(me,destroy_core)
implicit none
class(json_file),intent(inout) :: me
logical,intent(in),optional :: destroy_core !! to also destroy the [[json_core]].
!! default is to leave it as is.
if (associated(me%p)) call me%core%destroy(me%p)
if (present(destroy_core)) then
if (destroy_core) call me%core%destroy()
end if
end subroutine json_file_destroy