diff --git a/src/tests/jf_test_15.F90 b/src/tests/jf_test_15.F90 index e53986c71..d1991f946 100644 --- a/src/tests/jf_test_15.F90 +++ b/src/tests/jf_test_15.F90 @@ -216,7 +216,9 @@ subroutine test_15(error_cnt) !**************************************** - file1 = json_file(p2,json) !constructor + !file1 = json_file(p2,json) ! memory leak with gfortran? + call file1%initialize(json) + call file1%add(p2); nullify(p2) call file1%destroy(destroy_core=.true.) !**************************************** diff --git a/src/tests/jf_test_25.F90 b/src/tests/jf_test_25.F90 index 332ae7e4c..468542e86 100644 --- a/src/tests/jf_test_25.F90 +++ b/src/tests/jf_test_25.F90 @@ -108,7 +108,9 @@ subroutine test_25(error_cnt) #endif ! test json_file interface - f = json_file(p) + !f = json_file(p) ! memory leak in gfortran? + call f%initialize() + call f%add(p) nullify(p) ! data is now in f call f%get('str_array', vec, ilen, found) if (.not. found) then diff --git a/src/tests/jf_test_27.F90 b/src/tests/jf_test_27.F90 index 017ce0ece..d612ba3d9 100644 --- a/src/tests/jf_test_27.F90 +++ b/src/tests/jf_test_27.F90 @@ -60,7 +60,9 @@ subroutine test_27(error_cnt) call json%print(p,int(output_unit,IK)) ! test json_file interface - f = json_file(p) + !f = json_file(p) ! memory leak in gfortran? + call f%initialize() + call f%add(p) nullify(p) ! data is now in f call f%initialize(compress_vectors=.true.) call f%print() diff --git a/src/tests/jf_test_37.F90 b/src/tests/jf_test_37.F90 index eaa1ffd1d..a47fa7e54 100644 --- a/src/tests/jf_test_37.F90 +++ b/src/tests/jf_test_37.F90 @@ -39,26 +39,34 @@ subroutine test_37(error_cnt) call json%initialize(no_whitespace=.true.) call json%deserialize(p, CK_'{"a": ["1", "2", "3"]}') - f = json_file(p,no_whitespace=.true.) + !f = json_file(p,no_whitespace=.true.) ! memory leak in gfortran? + call f%initialize(no_whitespace=.true.) + call f%add(p) call f%print(int(error_unit,IK)) write(error_unit,'(A)') '' call check_for_error() call f%destroy() call json%deserialize(p, CK_'{"b": ["4", "5", "6"]}') - f = json_file(p,json) + !f = json_file(p,json) ! memory leak in gfortran? + call f%initialize(json) + call f%add(p) call f%print(int(error_unit,IK)) write(error_unit,'(A)') '' call check_for_error() call f%destroy() - f = json_file(CK_'{"x": [1,2,3]}',no_whitespace=.true.) + !f = json_file(CK_'{"x": [1,2,3]}',no_whitespace=.true.) ! memory leak in gfortran? + call f%initialize(no_whitespace=.true.) + call f%deserialize(CK_'{"x": [1,2,3]}') call f%print(int(error_unit,IK)) write(error_unit,'(A)') '' call check_for_error() call f%destroy() - f = json_file(CK_'{"y": [4,5,6]}',json) + !f = json_file(CK_'{"y": [4,5,6]}',json) ! memory leak in gfortran? + call f%initialize(json) + call f%deserialize(CK_'{"y": [4,5,6]}') call f%print(int(error_unit,IK)) write(error_unit,'(A)') '' call check_for_error() @@ -69,26 +77,34 @@ subroutine test_37(error_cnt) ! also test default character kind when unicode is enabled: call json%deserialize(p, CDK_'{"a": ["1", "2", "3"]}') - f = json_file(p,no_whitespace=.true.) + !f = json_file(p,no_whitespace=.true.) ! memory leak in gfortran? + call f%initialize(no_whitespace=.true.) + call f%add(p) call f%print(int(error_unit,IK)) write(error_unit,'(A)') '' call check_for_error() call f%destroy() call json%deserialize(p, CDK_'{"b": ["4", "5", "6"]}') - f = json_file(p,json) + !f = json_file(p,json) ! memory leak in gfortran? + call f%initialize(json) + call f%add(p) call f%print(int(error_unit,IK)) write(error_unit,'(A)') '' call check_for_error() call f%destroy() - f = json_file(CDK_'{"x": [1,2,3]}',no_whitespace=.true.) + !f = json_file(CDK_'{"x": [1,2,3]}',no_whitespace=.true.) ! memory leak in gfortran? + call f%initialize(no_whitespace=.true.) + call f%deserialize(CDK_'{"x": [1,2,3]}') call f%print(int(error_unit,IK)) write(error_unit,'(A)') '' call check_for_error() call f%destroy() - f = json_file(CDK_'{"y": [4,5,6]}',json) + !f = json_file(CDK_'{"y": [4,5,6]}',json) ! memory leak in gfortran? + call f%initialize(json) + call f%deserialize(CDK_'{"y": [4,5,6]}') call f%print(int(error_unit,IK)) write(error_unit,'(A)') '' call check_for_error() diff --git a/src/tests/jf_test_39.F90 b/src/tests/jf_test_39.F90 index a22cfaea9..eeec7cf2a 100644 --- a/src/tests/jf_test_39.F90 +++ b/src/tests/jf_test_39.F90 @@ -44,7 +44,9 @@ subroutine test_39(error_cnt) do i = 1, size(tests) - json = json_file(trim(tests(i)),verbose=.true.,stop_on_error=.true.) + !json = json_file(trim(tests(i)),verbose=.true.,stop_on_error=.true.) ! memory leak in gfortran? + call json%initialize(verbose=.true.,stop_on_error=.true.) + call json%deserialize(trim(tests(i))) call json%print(int(error_unit,IK)) write(error_unit,'(A)') '' if (json%failed()) then diff --git a/src/tests/jf_test_41.F90 b/src/tests/jf_test_41.F90 index 1fd6fc743..8e9cf0c39 100644 --- a/src/tests/jf_test_41.F90 +++ b/src/tests/jf_test_41.F90 @@ -57,7 +57,9 @@ subroutine test_41(error_cnt) write(error_unit,'(A)') '' write(error_unit,'(A)') 'copying to json_file...' - f = json_file(p) + !f = json_file(p) ! memory leak in gfortran? + call f%initialize() + call f%add(p) call f2%add(p2) nullify(p2) ! data is now in f diff --git a/src/tests/jf_test_46.F90 b/src/tests/jf_test_46.F90 index 558cc7f0d..92bca2e86 100644 --- a/src/tests/jf_test_46.F90 +++ b/src/tests/jf_test_46.F90 @@ -166,7 +166,8 @@ subroutine test_46(error_cnt) ! now, json_file routines: !--------------------------------- - json_f = json_file(str) + !json_f = json_file(str) ! memory leak in gfortran? + call json_f%deserialize(str) ! unicode: call json_f%get(CK_'not_there', ival, found, default=99_IK)