Memory leak in sclang

Hey all, this is my first post here. I’m having trouble with a 24/7 livestream I’m running from a remote ubuntu machine through OBS onto Youtube. I can start the livestream fine, but around 26 hours into a stream it inevitably crashes. I used to see xruns slowly become more common over the course of a stream but now I pretty much get none after messing around with Jack settings a bit.

My problem is pretty clearly that my machine is running out of memory:

In the above image you can see on the right my memory utilization ascending linearly over time (a few times). each pyramid corresponds to the triggering of a new stream, restarting the code that’s supposed to run indefinitely. on the left you can see CPU usage mostly staying horizontal. predictably, the streams crash when memory utilization approaches 100%.

Here is me attempting to update my version of supercollider. You can see the version of SuperCollider I’m using.

ubuntu@myFakeInstanceName:~$ sudo apt-get install supercollider
Reading package lists... Done
Building dependency tree
Reading state information... Done
supercollider is already the newest version (1:3.10.0+repack-1ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.

Here is the link to the code I’m running (~500 lines total): https://github.com/michaelmansourati/counterpoint

I had an earlier version of this running for a month straight very reliably, that started on August 1 of this year. I’m wondering if there was a bug introduced since then that has created a memory leak? If so, is there a fix coming for Ubuntu? I heard something about a memory leak fix.

Thanks in advance for your help!

(I can only embed one image in a post as a new user)

You can also see that my sclang is currently using a large amount of memory in my activity monitor after running for about a day.

Hi and welcome!

I remember fixing this issue back in 3.10.2. See here: https://github.com/supercollider/supercollider/issues/4268

apt-get install supercollider tends to give you really old versions. The SC devs don’t have control over when changes get rolled out to package managers, unfortunately.

My recommendation is to build the latest SC (3.12.1) yourself if you can.

If that seems daunting, a really quick and dirty fix would be to patch /usr/local/share/SuperCollider/SCClassLibrary/Common/GUI/Base/Menu.sc by renaming MainMenu:initClass to anything else. I might have that path wrong (not on Ubuntu atm) but you can probably find it with find /usr/ -name Menu.sc.

3 Likes

Thanks for replying! Is this the walkthrough to follow to build from source? https://github.com/supercollider/supercollider/wiki/Installing-SuperCollider-from-source-on-Ubuntu

That should do, yes. Happy to help if you run into any problems.

1 Like

All systems nominal! Thank you!