Skip to content

Commit cc5cf62

Browse files
committed
Add release/deallocate in examples to clean valgrind checks
1 parent 7647c84 commit cc5cf62

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

example/sort.f90

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ program sort_example
3838

3939
! Write output
4040
write(STDOUT, "(a, 4(f8.3,','))") "First few elements:", x(:min(4, size(x)))
41+
42+
call rng%release()
43+
44+
! Valgrind fails without deallocating the array, but technically it's not
45+
! necessary in Fortran to do this
46+
deallocate(x)
4147
contains
4248

4349
! Loop until the user inputs a positive integer. Catch error conditions.

example/vecstr.f90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ program vecstr_example
2727

2828
if (vec%empty()) then
2929
write(STDOUT, *) "No vectors provided"
30+
call vec%release()
3031
stop 0
3132
endif
3233

0 commit comments

Comments
 (0)