1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fix memory free

This commit is contained in:
Alexander Medvednikov
2019-07-21 15:05:47 +02:00
parent e2364f6285
commit 5d188130e5
4 changed files with 13 additions and 10 deletions

View File

@ -5,7 +5,6 @@
module builtin
struct array {
is_slice bool
pub:
// Using a void pointer allows to implement arrays without generics and without generating
// extra code for every type.
@ -146,7 +145,7 @@ pub fn (s array) slice(start, _end int) array {
data: s.data + start * s.element_size
len: l
cap: l
is_slice: true
//is_slice: true
}
return res
}
@ -220,9 +219,9 @@ pub fn (a []int) str() string {
//pub fn (a []int) free() {
pub fn (a array) free() {
if a.is_slice {
return
}
//if a.is_slice {
//return
//}
C.free(a.data)
}