patriciogonzalezvivo / glslViewer

Console-based GLSL Sandbox for 2D/3D shaders
BSD 3-Clause "New" or "Revised" License
4.62k stars 350 forks source link

`record` crashes with a memalloc error #268

Closed leiserfg closed 2 years ago

leiserfg commented 2 years ago

It says malloc(): corrupted top size and the video files created (name.mp4 and name_000.mp4 ) are empty.

patriciogonzalezvivo commented 2 years ago

What's the full command? Do you have ffmpeg installed on your system and is glslViewer compiled with support for it?

leiserfg commented 2 years ago

I just rebuilt the last commit on my laptop and it worked fine (previously was in my PC pointing to the latest release) so I will close the issue and try to recreate it again in my PC, sorry.

patriciogonzalezvivo commented 2 years ago

cool, glad it worked out

leiserfg commented 2 years ago

I'm back in the pc, the issue is not ffmpeg related, the error happens in this line (yes I decided to check the C++ code after years without touching that lang :smile: )
auto pixels = std::unique_ptr<unsigned char[]>(new unsigned char [width * height * 3]); I tried to split it (taking the creation of the array out like auto a = new unsigned char [width * height * 3]; and it breaks there so I think it has something to be with my screen size (1440p)

leiserfg commented 2 years ago

I was trying to valgrind it, but couldn't find extra info besides that the allocation is failing, I tried to use a memory sanitizer but there are several memory leaks of 3rd parties (even x11) so it finishes prematurely and I couldn't reach the bug.

patriciogonzalezvivo commented 2 years ago

do you mind clarifying what's the command that trigger the error?

leiserfg commented 2 years ago

I'm just doing record,asdf.mp4,0,1 . I debugged it and the crash happens while allocating the memory to store the screenshot but only happens in my PC (with a 1440 screen) and not on my laptop with a 1080p one.

patriciogonzalezvivo commented 2 years ago

I see... weird. Both runs linux, right?

leiserfg commented 2 years ago

Right

patriciogonzalezvivo commented 2 years ago

Mmm... The size of the screen shouldn't matter. it's only for recording mp4? whay happen when you make a PNG sequence?

sequence,0,1.
leiserfg commented 2 years ago

I just tested sequence,0,10 and it worked fine.

leiserfg commented 2 years ago

btw, I verified that ffmpeg is working (I ran the test_video example)