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

strings,builder: reduce V cgen and parser memory consumption, fix strings.Builder leak (#12342)

This commit is contained in:
Delyan Angelov
2021-10-31 12:58:55 +02:00
committed by GitHub
parent ce9f26c589
commit 6937074e7a
6 changed files with 72 additions and 15 deletions

View File

@ -238,6 +238,11 @@ pub fn (mut a array) delete_many(i int, size int) {
vmemcpy(&byte(a.data) + i * a.element_size, &byte(old_data) + (i + size) * a.element_size,
(a.len - i - size) * a.element_size)
}
if a.flags.has(.noslices) {
unsafe {
free(old_data)
}
}
a.len = new_size
a.cap = new_cap
}