Memory Leak on macOS 12.0.1 M1 Max

I’m trying to run a particle system app on macOS 12, and I’m seeing a pretty nasty memory leak. Based on looking at the trace files from Xcode, it seems like the two main culprits are some low level macOS system calls initiated from GLEW.

Stacktrace for IOSurface allocation location - Dropbox - IOSurface.png - Simplify your life

Stacktrace for IOAccelerator allocation location - Dropbox - IOAccelerator.png - Simplify your life

I’m not sure where to go to file a bug report about this? Would it be openFrameworks, GLEW, or to Apple itself?

Here is the source code for those who want to test themselves:

A link to the app (zip file of the app directory, with a built app in the zip) Dropbox - example-SimpleRandom.zip - Simplify your life

A link to the ofxFastParticleSystem code (in case it changes on github) - it’s the only addon being used. Dropbox - ofxFastParticleSystem.zip - Simplify your life

This is all on openFrameworks 0.11.2

Is it related to the 12.0.1 memory leak issues?

Unfortunately, I think it’s unlikely that that is the issue. In the example I provided, there is no mouse movement necessary, and just leaving it running without any interaction with the laptop results in a leak after about ~30 seconds on my machine.

Hi, is this happenign when you use your particles code only? Does it happen with any of the examples? Please test that, as it can give important information on where the problem might be

I had been writing several different sketches using various features, and none of them seemed to cause such a slowdown. Additionally, when I tried the above sketch on a 2014 MacbookPro running Catalina, it had no problems. I also modified the gpuParticleSystemExample that comes bundled with the openFrameworks Distirbution to produce a similar looking particle system Dropbox - gpuParticleSystemExample.zip - Simplify your life, and that one seems to run fine. Off the top of my head, the difference between the sketch using ofxFastParticleSystem and the vanilla OF sketch is that the one using ofxFastParticleSystem uses a single fragment shader to write out to 2 textures in a single draw call (updating both positions and velocity at once), where as the vanilla OF sketch uses 2 different shaders and 2 draw calls to update positions and velocities.

so, do you get that same memory leak when you run the gpuParticleSystemExample ?

1 Like

Nope, the bug is only in the sketch with ofxFastParticle system. Appreciate the pointer to the examples! Now I have a more targeted culprit to explore (and an alternative particle system implementation that doesn’t crash on my machine).

1 Like