Menu

#28 Stack size with SDL2-2.0.5

closed
Serg M
None
v2.0.0
1
2017-02-27
2017-02-26
No

The function Renderer::render() (Synth.cpp) uses a significant amount of stack memory in its temporary sample buffers. In ScummVM, we have recently been running into stack overflows in the audio thread due to this when using SDL2-2.0.5.

It turned out that SDL accidentally limited its audio thread stack size to 64kb ( https://bugzilla.libsdl.org/show_bug.cgi?id=3584 ). This has now been fixed in SDL, but since SDL2-2.0.5 is the most recent release of SDL2, and reverting to older SDL versions is not always an option due to other bugs on a few platforms, this means we currently can't use Munt on some platforms.

We are using an internal copy of Munt in ScummVM, so we can move these buffers from the stack ourselves to avoid the problem until we can move to a newer SDL, but we wanted to let you know this could be an issue in other applications using Munt as a library with SDL2-2.0.5. It might be worth considering doing the same to make the Munt library have less strict requirements on stack space.

We would appreciate not having to de-sync our internal copy of Munt, but of course we also understand that a temporary SDL bug is not your problem.

Discussion

  • Serg M

    Serg M - 2017-02-26
    • status: open --> accepted
    • assigned_to: Serg M
     
  • Serg M

    Serg M - 2017-02-26

    Yes, I think moving the buffers out from the stack is a good idea if so.

     
  • Serg M

    Serg M - 2017-02-27
    • status: accepted --> closed
     
  • Willem Jan Palenstijn

    Thank you! This indeed fixes the stack corruption for us.

     

Log in to post a comment.

MongoDB Logo MongoDB