From cf8776ac71963a576644f390b89326acfdc69ef6 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sun, 22 Mar 2020 13:31:53 +0100 Subject: [PATCH] valgrind: update the test --- vlib/v/tests/valgrind/1.vv | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/vlib/v/tests/valgrind/1.vv b/vlib/v/tests/valgrind/1.vv index e965117943..c90973b34e 100644 --- a/vlib/v/tests/valgrind/1.vv +++ b/vlib/v/tests/valgrind/1.vv @@ -1,18 +1,21 @@ import os -fn return_array(array_arg []string) []int { - s := [1, 2, 3] // escaping array must not be freed - return s +fn return_array(array_arg []string) []int { // array argument must not be freed + s := [1, 2, 3] // escaping array must not be freed + return s } fn foo() { - nums := [1, 2, 3] // local array must be freed - println(nums) + nums := [1, 2, 3] // local array must be freed + nums_copy := nums // array assignments call .clone() + println(nums) + println(nums_copy) + nums.free() } fn main() { - println('start') - foo() - println('end') + println('start') + foo() + println('end') }