vlang / v

Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io
MIT License
35.51k stars 2.15k forks source link

fireworks example crashes when compiled with -autofree #11463

Open pseudomo opened 2 years ago

pseudomo commented 2 years ago

V full version: V 0.2.4 c847152 OS: windows, Microsoft Windows 10 Business v19043 64-bit

What did you do? Compiled v as follows: make -clang

Compiled fireworks example with -autofree option v . -autofree

What did you expect to see? Application is running, memory is freed automatically

What did you see instead? Application started but after a few seconds crashed with the following error: Unhandled Exception 0xC0000374 C:/Users/User/AppData/Local/Temp/v/fireworks.10589391097515234349.tmp.c:9913: at print_backtrace_skipping_top_frames_tcc: Backtrace C:/Users/User/AppData/Local/Temp/v/fireworks.10589391097515234349.tmp.c:9880: by print_backtrace_skipping_top_frames C:/Users/User/AppData/Local/Temp/v/fireworks.10589391097515234349.tmp.c:9938: by unhandled_exception_handler 7ffebc8e8a4c : by ???

GZGavinZhao commented 2 years ago

Same here on amd64 Linux. Mine doesn't crash though; it runs and then the first firework freezes at the bottom of the screen. It throws an error of

7f3189cea0e1 : at ???: RUNTIME ERROR: invalid memory access

Just for some additional info, I don't see memory leaks even without autofree, -gc boehm also doesn't leak. It stabilizes at around 70 MB.

V doctor ``` OS: linux, "Solus" CC version: cc (Solus) 11.2.0 (basically gcc) V full version: V 0.2.4 72089c4.cd7d482 Git version: git version 2.32.0 Git vroot status: weekly.2021.36-46-gcd7d482c .git/config present: true thirdparty/tcc status: thirdparty-linux-amd64 333c14de ```
JalonSolov commented 2 years ago

With latest V, I get this:

[jamie@5950x examples]$ v -autofree run fireworks
malloc(): unsorted double linked list corrupted
7f480ae20d22 : at ???: RUNTIME ERROR: abort() called
malloc(): unsorted double linked list corrupted
Terminated by signal 134 (SIGABRT)
[jamie@5950x examples]$