Crash when repeatedly using `SDL_RenderCopy`

I’m having an issue that after a certain number of calls to SDL_RenderCopy I get a segfault. The program is working fine up until this point: it draws the expected elements without any glitches.

The stack trace is deep within the driver unfortunately:

#0  0x00007fffe548a167 in ?? () from /usr/lib/x86_64-linux-gnu/dri/
#11 0x00007fffe5155f87 in ?? () from /usr/lib/x86_64-linux-gnu/dri/
#12 0x00007fffece6bc06 in ?? () from /usr/lib/x86_64-linux-gnu/
#13 0x00007fffece633b1 in ?? () from /usr/lib/x86_64-linux-gnu/
#14 0x00007ffff7ff5877 in _init_module_sdl_render_blit_18 ()
#15 0x00007ffff7ff4a9e in _init_module_run_26 ()
#16 0x00007ffff7ff348d in _init_module_main_38 ()

Perhaps I’m missing some kind of “free” operation? My general flow of events, in the main loop is:

  • while SDL_PollEvent(e) != 0
  • SDL_SetRenderDrawColor
  • SDL_RenderClear
  • SDL_GetWindowSize
  • SDL_RenderCopy
  • SDL_RenderPresent

My actual code is written in Leaf, my experimental language. Given the consistency and location of the failure though, I don’t think I have an API/ABI interface issue.

Is there something I’m missing? If not, any ideas on how I can go about debugging such an issue?

Platform: Ubuntu 16.04
Device: AMD JUNIPER (DRM 2.43.0 / 4.4.0-116-generic, LLVM 5.0.0) (0x68bf)

Note, there’s still a > 90% chance this is my compiler’s fault. I’m just hoping somebody may have insight in the odd chance this happens to be an SDL issue.

Sorry, you can disregard this. I’ve identified an errant alloca inside the loop. Thus I eventually run out of stack space. The consistent backtrace appearing inside the driver/SDL is most likely because it’s a deep stack and the first thing to notice there is no stack left.