I had two experimental code paths with two different problems this morning.

  1. I could reuse textures over and over again, which would crash intermittently if I was trying to use the texture on two threads (I couldn’t seem to get the locks in all the right places, which I assume is because Apple’s OpenGL implementation likely caches commands for later use).
  2. I could create new textures every time I needed to upload some buffers into OpenGL. This created a monster memory leak.
I went with option two. It turns out the memory leak seems to be in Apple’s code (as usual): I fixed it by, instead of deleting textures, storing them in a pool which I could pull from when I need a ‘new’ texture.

posted : Friday, May 30th, 2008

tags :