v icon indicating copy to clipboard operation
v copied to clipboard

V initialises unused modules

Open clubby789 opened this issue 3 years ago • 7 comments

V version: V 0.2.2 82650ee

What did you do?

module main

import net.http

fn main() {
    println('hi')
}
[ ... ]
v -autofree test.v
valgrind ./test

What did you expect to see? No memory leaks

What did you see instead?

==3818== HEAP SUMMARY:
==3818==     in use at exit: 199 bytes in 7 blocks
==3818==   total heap usage: 4,608 allocs, 4,601 frees, 174,297 bytes allocated

The generated C code contains initialisation blocks for net.openssl, os, net.urllib etc. As well as initialising modules that the compiler recognises as unused, autofree fails to free these allocations.

clubby789 avatar Feb 14 '21 13:02 clubby789