Grey count error

Trying to post here even though I can’t share right now the whole project’s source.
topic: I’m getting a grey count error while running a long process. It’s garbage collection right? Any hint about how to debug this? I know this is hard without any code, but really any help would be appreciated.

I’m doing nasty stuff, probably the wrong way. Among the things I do, there is:

  • dynamic allocation and freeing of buffers, like hundred times per second.
  • those buffers are allocated and freed by independent threads: every three seconds a new thread is spawn, which loads some buffers. Buffers correspond to events, which are played on the main thread while a new thread is allocating more buffers. When all the events (from those three seconds) are played, the corresponding buffers are freed.
  • data is received from a python program to OSC. every message is timestamped and goes into a dictionary. Every three seconds, that dictionary is deep-copied to the thread that will allocate corresponding buffers, and cleared.
  • also, when I load a buffer, I convert from array to env to signal to wavetable.

valgrind says:
Error in function boost::math::erfc_inv<long double>(long double, long double): Overflow Error
And I really don’t know why erfc_inv is called at all… couldn’t track it further down.

I was wrong here, that was sclang crashing right away when run in valgrind (sorry, I’m not even a beginner in debugging)
I tried running gdb on the core dump, and I get this backtrace :

#0  PyrGC::ScanSlots (this=this@entry=0x56516e13e7c0, inSlots=inSlots@entry=0x56516d763150, inNumToScan=<optimized out>)
    at /home/giano/.local/src/supercollider/lang/LangSource/GC.cpp:182
#1  0x000056516c1d38c0 in PyrGC::ScanSlots (inNumToScan=<optimized out>, inSlots=0x56516d763150, this=0x56516e13e7c0)
    at /home/giano/.local/src/supercollider/lang/LangSource/GC.cpp:553
#2  PyrGC::ScanOneObj (this=this@entry=0x56516e13e7c0) at /home/giano/.local/src/supercollider/lang/LangSource/GC.cpp:553
#3  0x000056516c1d39a8 in PyrGC::Collect (this=this@entry=0x56516e13e7c0) at /home/giano/.local/src/supercollider/lang/LangSource/GC.cpp:675
#4  0x000056516c1d3bf4 in PyrGC::Allocate (inRunCollection=<optimized out>, sizeclass=<optimized out>, inNumBytes=16, this=0x56516e13e7c0)
    at /home/giano/.local/src/supercollider/lang/LangSource/GC.h:307
#5  PyrGC::New (this=0x56516e13e7c0, inNumBytes=16, inFlags=0, inFormat=inFormat@entry=1, inRunCollection=<optimized out>)
    at /home/giano/.local/src/supercollider/lang/LangSource/GC.cpp:357
#6  0x000056516c2a95ac in instantiateObject (gc=<optimized out>, classobj=0x56516c8762c0, size=1, fill=fill@entry=false, runGC=runGC@entry=true)
    at /home/giano/.local/src/supercollider/lang/LangSource/PyrObject.cpp:1833
#7  0x000056516c1f6310 in basicNew (g=<optimized out>, numArgsPushed=<optimized out>)
    at /home/giano/.local/src/supercollider/lang/LangPrimSource/PyrPrimitive.cpp:707
#8  0x000056516c1feff2 in doPrimitive (g=0x56516c5346a0 <gVMGlobals>, meth=0x56516e14e140, numArgsPushed=<optimized out>)
    at /home/giano/.local/src/supercollider/lang/LangPrimSource/PyrPrimitive.cpp:3871
#9  0x000056516c1d4799 in Interpret (g=0x56516e13e7c0, g@entry=0x56516c5346a0 <gVMGlobals>)
    at /home/giano/.local/src/supercollider/lang/LangSource/PyrInterpreter3.cpp:3034
#10 0x000056516c29a058 in runAwakeMessage (g=0x56516c5346a0 <gVMGlobals>)
    at /home/giano/.local/src/supercollider/lang/LangSource/PyrInterpreter3.cpp:148
#11 0x000056516c1f358a in TempoClock::Run (this=0x56516cfba1e0) at /home/giano/.local/src/supercollider/lang/LangPrimSource/PyrSched.cpp:804
#12 0x00007f447e369b24 in std::execute_native_thread_routine (__p=0x56516ced0b80) at /build/gcc/src/gcc/libstdc++-v3/src/c++11/
#13 0x00007f4487fdb46f in start_thread () from /usr/lib/
#14 0x00007f447e0713d3 in clone () from /usr/lib/

:robot: :ghost: :robot: :ghost: :robot: :ghost: :japanese_ogre: :japanese_ogre: :japanese_ogre: :japanese_ogre: :japanese_ogre: :japanese_ogre: :exploding_head: