What is this error

only happend when start --release app

Unhandled exception: Negative count (ArgumentError)
  from src\minimp3.cr:679 in '__crystal_main'
  from E:\scoop\global\apps\crystal\current\src\crystal\main.cr:141 in 'main'
  from E:\scoop\global\apps\crystal\current\src\crystal\system\win32\wmain.cr:37 in 'wmain'
  from D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288 in '__scrt_common_main_seh'
  from C:\WINDOWS\System32\KERNEL32.DLL +75133 in 'BaseThreadInitThunk'
  from C:\WINDOWS\SYSTEM32\ntdll.dll +371272 in 'RtlUserThreadStart'

Uh, can you share the code that reproduces this? Otherwise it’s kind of hard to say.

EDIT: Or at least what’s at src\minimp3.cr:679.

:thinking::thinking::thinking:

do not work when comment p! sample_bytes

works well when uncomment p! sample_bytes

UPDATE:

  • from:

dec = uninitialized LibMinimp3::Mp3decT

  • to:

p_dec = Pointer(LibMinimp3::Mp3decT).malloc(1)

From what I understand, your problem only shows with --release, is that right? Because if so, then this sounds like a bug in the compiler (but maybe it’s a bug that only shows in --release?). Can you get a minimum working example if you think this is not a bug from the application?