Gitly
English
Русский
Español
日本語
中文
Português
Log in
Register
v2
/
vlib
/
v
/
slow_tests
/
valgrind
/
struct_field.v
17
lines
·
15
sloc
·
207 bytes
·
6a32c810703f4ec0c39fe18298ebe6c40acac8f1
Raw
1
struct
LeakStruct {
2
mut
:
3
some_bytes []u8
4
}
5
6
fn
(
mut
l LeakStruct) free() {
7
unsafe {
8
l.some_bytes.free()
9
}
10
}
11
12
fn
main() {
13
z := &LeakStruct{
14
some_bytes: []u8{len: 1000}
15
}
16
println(z.some_bytes.len)
17
}
18