vlang / sdl

Official SDL2 bindings for V
https://vlang.io
MIT License
77 stars 13 forks source link

Basic window example crash #743

Closed alfaus closed 6 months ago

alfaus commented 6 months ago

The basic_window example (and any other program that uses the module) crash with the message "free(): invalid pointer". I have installed the version of the module that corresponds to the SDL version of the system. Other programs using a SDL wrapper (in pascal) work without problems.

larpon commented 6 months ago

Can you try and compile / run with the flag -d sdl_memory_no_gc and see if that helps? It disables the garbage collector so it does not interfere with SDLs memory functions. The trade off is that you then need to manually free what you allocate and will likely have a small memory leak on SDL start or shutdown

alfaus commented 6 months ago

Yes! That workaround works perfectly. Thanks a lot!

larpon commented 6 months ago

I'm glad to help. Enjoy coding with V and SDL2!